1 Reply Latest reply on Feb 16, 2011 6:53 PM by sverker

    Web mapping already exists for deployment

    sverker

      Hi,

      I just installed JBoss AS 6.0.0.Final and tried to deploy my application which has one .ear with several .war files. The .war files use virtual-host setting in jboss-web.xml to bind to different url's and they all have context path "/"

       

      This works fine on 5.1.0.GA, but when deploying on 6.0.0.Final it throws an exception with message "Web mapping already exists for deployment". I recall it was the same problem with JBoss AS 5.0.0 when it came out and it was corrected in 5.0.1 and 5.1.0.

       

      Another issue is with application.xml in the ear, when I set the version 5 schema it complains on that all the .war files have context root /, it doesn't take into account that they are to be deployed to different virtual hosts. I workaround that by using the old 1.3 dtd instead.

        • 1. Web mapping already exists for deployment
          sverker

          Ok, I found it. Say that in my case I have a virtual host www.foohttp://www.foo.o/.com which is not defined as host in Jbossweb config file. When it is deployed, org.jboss.web.tomcat.service.deployers.TomcatDeployment.mapVirtualHosts tries to map the virtual host to a configured host, fail to find one that maps to the virtual name and create an alias to localhost, the default host.

           

          It then returns the mapped host name, in this case "localhost" back to TomcatDeployment.performDeploy, which calls performDeployInternal. There an object name with content

          jboss.web:j2eeType=WebModule,name=//localhost/,J2EEApplication=none,J2EEServer=none and checked against the registry. It already exsist since ROOT.war is deployed to that as well so an exception with message "Web mapping already exsists" is thrown.

          The workaround should be to create host entries for each virtual host in JBossWeb config. I'll check if there i a jiira entry, otherwise create one