3 Replies Latest reply on Oct 28, 2007 1:23 PM by worldofnic

    5.0.0 beta 2 and virtual hosts

    worldofnic

      Hi,

      firstly I'm new to JBoss (But I've experience with Tomcat, Sun Java System Application Server and a bit with Jetty). I'm having a problem with virtual hosts. All my wars seem to ignore the virtual-host setting and try to overwrite each other in all hosts?

      In each (unexploded) war, I've put a WEB-INF/jboss-web.xml

      <!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>
       <virtual-host>domain.example</virtual-host>
      </jboss-web>
      



      And multiple instances of the Host section in server.xml

       <Host name="domain.example" autoDeploy="false"
       deployOnStartup="false"
       deployXML="false">
      
       <!-- Add all your aliases here -->
       <Alias>www.domain.example</Alias>
      
       <!-- Set up logging -->
       <Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" prefix="domain.example" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/>
       <DefaultContext cookies="true" crossContext="true" override="true"/>
       </Host>
      


      However, all the contexts overlap, ignoring the virtual-host setting in jboss-web.xml. Clearly, I've made a mistake and missed something. Any clues people?

      The errors in stdout/err are:
      22:06:17,476 ERROR [ServiceDeployer] Error during deployment: vfsfile:/opt/jboss-5.0.0.Beta2/server/default/deploy/example.war
      org.jboss.deployment.DeploymentException: Error during install jboss.web.deployment:war=/
       at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:52)
       at org.jboss.system.ServiceController.install(ServiceController.java:277)
       at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:94)
       at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
       at org.jboss.deployers.plugins.deployers.helpers.AbstractSimpleRealDeployer.deploy(AbstractSimpleRealDeployer.java:56)
       at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDeploy(AbstractSimpleDeployer.java:52)
       at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(DeployerWrapper.java:170)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(MainDeployerImpl.java:592)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:476)
       at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainDeployerImpl.java:406)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
       at org.jboss.profileservice.aop.MainDeployerAspect.process(MainDeployerAspect.java:53)
       at org.jboss.aop.advice.org.jboss.profileservice.aop.MainDeployerAspect_z_process_10410279.invoke(MainDeployerAspect_z_process_10410279.java)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at AOPContainerProxy$0.process(AOPContainerProxy$0.java)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:371)
       at org.jboss.system.server.profileservice.ProfileServiceBootstrap.bootstrap(ProfileServiceBootstrap.java:247)
       at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89)
       at org.jboss.system.server.profileservice.ServerImpl.doStart(ServerImpl.java:403)
       at org.jboss.system.server.profileservice.ServerImpl.start(ServerImpl.java:342)
       at org.jboss.Main.boot(Main.java:210)
       at org.jboss.Main$1.run(Main.java:522)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalStateException: jboss.web.deployment:war=/ is already installed.
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:264)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:192)
       at org.jboss.system.ServiceController.doInstall(ServiceController.java:638)
       at org.jboss.system.ServiceController.install(ServiceController.java:271)
       ... 26 more
      \[...\]
      *** DEPLOYMENTS IN ERROR: Name -> Error
      
      vfsfile:/opt/jboss-5.0.0.Beta2/server/default/deploy/exampl.war -> java.lang.IllegalStateException: jboss.web.deployment:war=/ is already installed.
      
      
      


      MTIA,
      nic


        • 1. Re: 5.0.0 beta 2 and virtual hosts
          david.wade

          JBoss by default has an application deployed on the root context "/" which I believe will be visible across all virtual hosts as it is not bound to any particular virtual host.

          That root application (look for ROOT.war in the deploy directory) doesn't really provide any critical functionality, just links to the jmx-console, the web-console and tomcat status etc.

          Your options are to remove the application -just delete the entire directory or to edit the web.xml to move it off the root context.

          Have always thought it rather inconvenient/awkward that the root context is already used in JBoss. It would be much better if both that root application and the jmx and web consoles were under an appropriate context like /jboss-admin. Having them under a single context not only gets them out of the way, it makes it simpler to restrict access at a network dispatcher or apache level.

          • 2. Re: 5.0.0 beta 2 and virtual hosts
            worldofnic

            Even removing all wars from /opt/jboss-5/server/default/deploy you still get /web-console loaded (fair enough) and any attempt to deploy another war with the context of / will cause the error to be thrown that / already exists.

            Now, one of the issues may be to do with some Ubuntu-ism that I'm using 127.0.0.1 and 127.0.1.1 (wtf?) If not, I may have hit a bug.

            It's a shame I haven't tried 4.2.x isn't it?

            nic

            • 3. Re: 5.0.0 beta 2 and virtual hosts
              worldofnic

              OK - I've tried 4.2.1 GA and that works fine. So, I'll skip 5.0.0 until it's released and there's a bit more documentation/community knowledge floating about.