在JBoss AS 7中将项目指定至'/'根目录

1.创建WEB-INF/jboss-web.xml文件,全部内容如下:

Xml代码   收藏代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <jboss-web>  
  3.     <context-root>/</context-root>  
  4. </jboss-web>  



2.修改/jboss-as-7.0.0.Final/standalone/configuration/standalone.xml文件
在文件的最后找到

Xml代码   收藏代码
  1. <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">  
  2.   <connector name="http" scheme="http" protocol="HTTP/1.1" socket-binding="http"/>  
  3.   <virtual-server name="default-host" enable-welcome-root="true">  
  4.     <alias name="localhost" />  
  5.     <alias name="example.com" />  
  6.   </virtual-server>  
  7. </subsystem>  


将enable-welcome-root="true"删除
否则启动时会抛出"Child container with name  already exists"错误

说明:经尝试,将enable-welcome-root="false"也可以实现目的,首推false设置。

猜你喜欢

转载自lihaiming.iteye.com/blog/2207615