如何为payara micro设置空的上下文根



我的应用程序在没有设置任何上下文根的情况下与payara服务器一起工作,但payara micro将默认上下文根设置为我的war文件的名称。如果是payara micro,我如何将上下文根设置为空?

其中一种方法是将war名称设置为ROOT.war,但使用该名称,我在部署时会出现以下错误。我试着把xerces-2.9.1 jar放在--addLibs中,但不起作用。

2020-08-20T21:36:53.110+0200] [] [SEVERE] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1597952213110] [levelValue: 1000] [[
Exception while invoking class com.sun.enterprise.web.WebApplication start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.AbstractMethodError
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:136)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:280)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:344)
at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:584)
at fish.payara.deployment.admin.InitializeAllApplicationsCommand.execute(InitializeAllApplicationsCommand.java:75)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:558)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:554)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:553)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:584)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:576)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1496)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:120)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1878)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1754)
at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.executeCommand(CommandExecutorImpl.java:183)
at com.sun.enterprise.admin.cli.embeddable.CommandExecutorImpl.run(CommandExecutorImpl.java:96)
at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1063)
at fish.payara.micro.impl.PayaraMicroImpl.create(PayaraMicroImpl.java:211)
at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:200)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:50)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:114)
at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:73)
at fish.payara.micro.boot.PayaraMicroLauncher.create(PayaraMicroLauncher.java:87)
at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:71)
at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:397)
]]

首先,你不应该因为将应用程序重命名为ROOT.war而出现错误。如果在最新版本的Payara Micro上发生这种情况,你应该提出github问题:https://github.com/payara/Payara/issues

现在回到问题上来。您可以将--contextroot命令行选项设置为/:来设置上下文根

java -jar payara-micro.jar --contextroot / app.war

如果部署多个应用程序或资源,可以在部署文件的名称中指定上下文根,用冒号(或Windows上的分号(分隔,例如:

java -jar payara-micro.jar app.war:/

以下是有关此方面的完整文档:https://docs.payara.fish/community/docs/5.2020.4/documentation/payara-micro/deploying/deploy-cmd-line.html#define-上下文根

相关内容

  • 没有找到相关文章

最新更新