23

I want to change context root from "/war_name" (by default) to "/".

Thus, I created a jboss-web.xml file that I pushed in WEB-INF directory.

Content of this file is :

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>/</context-root>
</jboss-web>

Unfortunately, this causes the following error during war deployment :

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: 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:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.7.0_01]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.7.0_01]
    at java.lang.Thread.run(Thread.java:722) [:1.7.0_01]
Caused by: java.lang.IllegalArgumentException: Child container with name  already exists
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:804)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:792)

However, when I put some directory name like : /RoomManagement, I don't have this issue. But if I use this one, I couldn't access to JSPs that aren't in /RoomManagement.

Have you an idea for well-configuring context-root to "/" ?

Mik378
  • 21,881
  • 15
  • 82
  • 180

1 Answers1

59

It looks like there is another app that's running at the root context "/".

You may have to delete the other app or move it to a different context before you can assign your app to the root context.

If the conflicting app is JBoss AppServer root itself, you can disable that using the following (enable-welcome-root="false")

<subsystem xmlns="urn:jboss:domain:web:1.0">
  <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
  <virtual-server name="localhost" enable-welcome-root="false">
    <alias name="example.com"/>
  </virtual-server>
</subsystem>
uaarkoti
  • 3,659
  • 2
  • 20
  • 23
  • 2
    This file where this XML is located (if running in the default standalone mode) is in %JBOSS_HOME%/configuration/standalone.xml. – GreenieMeanie Nov 05 '13 at 17:25
  • 1
    Use jboss cli if run as domain mode. `/profile=default/subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false)` – Seonhyu Jun 18 '14 at 02:35