java 在 JBOSS EAP 6.1 上部署 Spring Boot
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37737129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Deploying spring boot on JBOSS EAP 6.1
提问by kamalp
I am trying to deploy a jar on Jboss 6.1 EA. I had build the jar file.
我正在尝试在 Jboss 6.1 EA 上部署一个 jar。我已经构建了 jar 文件。
I am unable to access the page http://localhost:8080/$YOURAPP/hello/World
, because I get a 404 error. I replaced the $YOURAPP
with the name of the war file. I do not get any errors while starting jboss, it shows the war is getting deployed.
我无法访问该页面http://localhost:8080/$YOURAPP/hello/World
,因为我收到 404 错误。我用$YOURAPP
war文件的名称替换了。启动 jboss 时我没有收到任何错误,这表明War正在部署。
回答by Dieter Hubau
You will definitely need a .war
file for JBoss because a (fat) .jar
file will not work.
For JBoss, you will also need a jboss-web.xml
descriptor file in src/main/webapp/WEB-INF
file containing the context root of your application.
您肯定需要一个.war
JBoss 文件,因为(胖).jar
文件不起作用。对于 JBoss,您还需要一个包含应用程序上下文根的jboss-web.xml
文件中的描述符文件src/main/webapp/WEB-INF
。
For example:
例如:
<jboss-web>
<context-root>YOUR_APP_ROOT</context-root>
</jboss-web>
After that, you will need to set one more Spring Boot property to make this work on JBoss EAP 6:
之后,您需要再设置一个 Spring Boot 属性以使其在 JBoss EAP 6 上工作:
server.servlet-path = /*
This is due to a quirk in JBoss itself, if you don't have this property set to /*
it will not work.
这是由于 JBoss 本身的一个怪癖,如果您没有设置此属性/*
,它将无法工作。