-
1. Re: how to change context root?
bassix Aug 30, 2012 7:25 AM (in response to ryannewbie)In the deploy folder, you will find ROOT.war which is the holding the default context path (/). In order to make your application use the context root as /, you need to rename your war as ROOT.war (and possibly rename the old ROOT.war to ROOT_original.war so that you can retain in case you want to revert back.
HTH,
Krishna
-
2. Re: how to change context root?
ryannewbie Aug 30, 2012 9:23 AM (in response to bassix)I am using jboss AS 7. under standalone/deployments there is no root.war dir.
however, there is a welcome-content under jboss_home dir which seems like the root.
-
3. Re: how to change context root?
bassix Aug 31, 2012 12:57 AM (in response to ryannewbie)Alright, I am not that familiar with JBoss AS 7 yet. Still trying my hands on it.
Hope somebody else can answer your question.
-
4. Re: how to change context root?
vatsanm Aug 31, 2012 11:11 AM (in response to bassix)Ryan,
In your standalone/deployments dir, you can deploy your app as ROOT.war or unwar your app as ROOT.war. this will change your root context to '/' instead of /appname/.
So if you do an ls in your deplyments dir, it will look like below.
/standalone/deployments>n-> ls -al
total 24
drwxr-xr-x 2 vzwadmin vzwadmin 1024 Aug 30 09:08 .
drwxr-xr-x 12 vzwadmin vzwadmin 1024 Apr 20 14:32 ..
-rw-r----- 1 vzwadmin vzwadmin 8868 Mar 13 12:03 README.txt
lrwxr-xr-x 1 vzwadmin vzwadmin 34 Aug 29 10:43 ROOT.war -> /usr/home/vatsan/deploy/myapp.war
-rw-r--r-- 1 vzwadmin vzwadmin 8 Aug 29 10:43 ROOT.war.deployed -
5. Re: how to change context root?
ryannewbie Sep 1, 2012 7:16 AM (in response to vatsanm)It works now. but i did switch the enable-welcome-root to false in case it's useful.
Thanks
-
6. Re: how to change context root?
ryannewbie Sep 1, 2012 7:31 AM (in response to ryannewbie)here is my steps to change a webapp with / as context root
change enable-welcome-root to false in JBOSS_HOME/standalone/configuration/standalone.xml
make the deployed app name to ROOT.war and ROOT.war.deployed
under /web-inf, create a jboss-web.xml with the following content
<?xml version="1.0"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<context-root>/</context-root>
</jboss-web>
-
7. Re: how to change context root?
carlogo Aug 27, 2013 9:36 AM (in response to ryannewbie)Hi Ryan, I am using jboss EAP 6.1. and I am trying to set context-root to '/' following your steps, but I get the next messages when I rename my app to ROOT.war.
15:30:18,749 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.web.deployment.default-host./ROOT: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: 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_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.IllegalStateException: JBAS018038: Root contexts can not be deployed when the virtual host configuration has the welcome root enabled, disable it and redeploy
at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:57)
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
How did you start jboss with this settings? Any help?
Many thanks in advance.
Carlos.
-
8. Re: how to change context root?
vatsanm Aug 27, 2013 11:30 AM (in response to carlogo)In the JBoss configuration file (I use standalone.xml), the enable-welcome-root is as below. After you change it, then you can restart the server for this to take effect.
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="true">
<connector name="ajp" protocol="AJP/1.3" scheme="ajp" socket-binding="ajp" secure="true"/>
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="my.server.com"/>
<alias name="localhost"/>
</virtual-server>
</subsystem>
-
9. Re: how to change context root?
carlogo Aug 28, 2013 4:13 AM (in response to vatsanm)Perfect Vatsan! It is solved. I was modifying the standalone.xml file but it is the standalone-ha.xml configuration file by default if you are executing as root user.
Thanks so much!
Carlos.