Mik378 Mik378 - 1 month ago 6x
Java Question

Changing context root for a web app under JBoss As 7

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"?>

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 "/" ?


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"/>