JBoss配置war使用根路径
2016-10-19 本文已影响243人
ilaoke
https://developer.jboss.org/thread/213580
http://stackoverflow.com/questions/16112228/mod-cluster-virtual-hosts-and-jboss-root-context-in-jboss-eap-6
在WEB-INF/下创建jboss-web.xml文件
<jboss-web>
<context-root>/</context-root>
</jboss-web>
此时访问应用,就可以直接IP + 端口
如果使用Apache httpd + Mod_cluster + JBoss搭建的集群环境,还需要修改Mod_cluster的配置,将ROOT从Excluded Contexts中去除,如下图:
mod_cluster-remove-root.png
JBWEB000250: Child container with name already exists
14:12:23,644 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-13) MSC000001: Failed to start service jboss.web.deployment.default-host./: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: java.lang.IllegalArgumentException: JBWEB000250: Child container with name already exists
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:794)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:785)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:353)
at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:62)
at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:38)
at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:55) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1549) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl.access$1900(ServiceControllerImpl.java:49) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1780) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1741) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
... 3 more
修改指定的standalone-*.xml文件的配置,将enable-welcome-root改false
好久没写点东西了,最近郑州房价暴涨,没有早点上车...TMD,此处省略一万字...