本文介绍了在JBOSS EAP 6.1上部署Spring Boot的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Jboss 6.1 EA上部署一个jar.我已经建立了jar文件.

I am trying to deploy a jar on Jboss 6.1 EA. I had build the jar file.

我无法访问页面http://localhost:8080/$YOURAPP/hello/World,因为出现404错误.我将$YOURAPP替换为war文件的名称.启动jboss时没有出现任何错误,表明战争正在部署.

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.

推荐答案

对于JBoss,您肯定需要一个.war文件,因为(fat).jar文件将不起作用.对于JBoss,在src/main/webapp/WEB-INF文件中还需要一个jboss-web.xml描述符文件,其中包含应用程序的上下文根.

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.

例如:

<jboss-web>
    <context-root>YOUR_APP_ROOT</context-root>
</jboss-web>

此后,您将需要再设置一个Spring Boot属性,以使其在JBoss EAP 6上起作用:

After that, you will need to set one more Spring Boot property to make this work on JBoss EAP 6:

server.servlet-path = /*

这是由于JBoss本身存在一个怪癖,如果您没有将此属性设置为/*,它将无法正常工作.

This is due to a quirk in JBoss itself, if you don't have this property set to /* it will not work.

更多信息此处此处

这篇关于在JBOSS EAP 6.1上部署Spring Boot的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 04:22