3 Replies Latest reply on Feb 6, 2008 9:39 AM by anil.saldhana

    question related to same war name conflict during deployment

    soshah

      This is related to one of the test cases in the org.jboss.test.web.test.WebIntegrationUnitTestCase that tests to make sure that when a ear file containing a war file with the same name as an already installed war file is deployed, the deployment happens successfully.

      Here is the test code

      /** Deploy a second ear that include a notjbosstest-web.war to test ears
       with the same war names conflicting.
       Access the http://{host}/jbosstest-not2/unrestricted/SecureServlet
       */
       public void testNotJbosstest2() throws Exception
       {
       try
       {
       deploy("jbosstest-web2.ear");
       String baseURL = "http://" + getServerHost() + ":" + Integer.getInteger("web.port", 8080) + '/';
       URL url = new URL(baseURL+"jbosstest-not2/unrestricted/SecureServlet");
       HttpUtils.accessURL(url, REALM, HttpURLConnection.HTTP_OK);
       }
       finally
       {
       undeploy("jbosstest-web2.ear");
       } // end of try-finally
       }
      


      After drilling down the code/errors, I have found out that, the tomcat side of deployment is working fine, even creating the new web context. However, the Service registration runs into issues since org.jboss.dependency.plugins.AbstractController does not allow the registration of the ControllerContext related to this deployment unit.

      This is because both services have the same service id which comes out to be:
      jboss:id=notjbosstest-web.war,service=jacc in this testcase

      looks like creation of the service id is based on the war name and not based on the web context being created.

      What would be the best strategy to create a different service id that still links back to the web application being deployed without creating unwanted side effects?

      Here is the full stack trace of the error:
      02:35:30,729 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/home/soshah/projects/jboss-as/trunk/testsuite/output/lib/jbosstest-web2.ear state=PostClassLoader mode=Manual requiredState=Real
      org.jboss.deployment.DeploymentException: Error during install jboss:service=jacc,id=notjbosstest-web.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:99)
       at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
       at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
       at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
       at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:874)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:906)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
       at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
       at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
       at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
       at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:812)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       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.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:270)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
       at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:815)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:416)
       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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
       at sun.rmi.transport.Transport$1.run(Transport.java:153)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.IllegalStateException: jboss:id=notjbosstest-web.war,service=jacc is already installed.
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:525)
       at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)
       at org.jboss.system.ServiceController.doInstall(ServiceController.java:641)
       at org.jboss.system.ServiceController.install(ServiceController.java:271)
       ... 69 more
      


      Thanks