Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-873

Deploying the same ejb in two different webapps causes a DuplicateDeploymentIdException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1
    • Component/s: tomee
    • Labels:
      None

      Description

      I deployed two ejb's i.e. Calculator and Greeting in a webapp named dummy (i.e. context root was dummy). Then I copied the webapp dummy and pasted it under tomcat/webapps but renamed the context root to myfaces. This way I had two exact same webapps, but there were two different context roots. When I start tomcat and open the <<tomcat-install>>/conf/openejb.log, the log shows me a DuplicateDeploymentIdException for one of the webapps (the one which started later). This is because a deploymentId was already assigned to the earlier webapp. So I decided to change the default deploymentId of a module by adding the following in <<Tomcat-install>>/conf/system.properties file

      openejb.deploymentId.format=

      {moduleId}

      /

      {ejbName}

      When I restarted tomcat, i still got the same exception. The reason is that the moduleId of every web module which contains EJB's is named as "classes". Here is the exception:

      2008-07-27 18:48:22,692 - INFO - Configuring enterprise application: /home/karan/install/apache-tomcat-6.0.16/webapps/dummy
      2008-07-27 18:48:22,692 - DEBUG - No ejb-jar.xml found assuming annotated beans present: /home/karan/install/apache-tomcat-6.0.16/webapps/dummy, module: classes
      2008-07-27 18:48:22,701 - INFO - Enterprise application "/home/karan/install/apache-tomcat-6.0.16/webapps/dummy" loaded.
      2008-07-27 18:48:22,702 - INFO - Assembling app: /home/karan/install/apache-tomcat-6.0.16/webapps/dummy
      2008-07-27 18:48:22,728 - DEBUG - Using openejb.jndiname.strategy.class 'org.apache.openejb.assembler.classic.JndiBuilder$TemplatedStrategy'
      2008-07-27 18:48:22,729 - DEBUG - Using openejb.jndiname.format '

      {deploymentId} {interfaceType.annotationName}

      '
      2008-07-27 18:48:22,731 - INFO - Jndi(name=GreeterImplLocal) --> Ejb(deployment-id=GreeterImpl)
      2008-07-27 18:48:22,732 - INFO - Jndi(name=MathCalculatorLocal) --> Ejb(deployment-id=MathCalculator)
      2008-07-27 18:48:22,732 - INFO - Created Ejb(deployment-id=GreeterImpl, ejb-name=GreeterImpl, container=My Stateless Container)
      2008-07-27 18:48:22,732 - INFO - Created Ejb(deployment-id=MathCalculator, ejb-name=MathCalculator, container=My Stateless Container)
      2008-07-27 18:48:22,732 - INFO - Deployed Application(path=/home/karan/install/apache-tomcat-6.0.16/webapps/dummy)
      2008-07-27 18:48:22,732 - DEBUG - App Created Event: CxfService: /home/karan/install/apache-tomcat-6.0.16/webapps/dummy
      2008-07-27 18:48:25,740 - INFO - Configuring enterprise application: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces
      2008-07-27 18:48:25,740 - DEBUG - No ejb-jar.xml found assuming annotated beans present: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces, module: classes
      2008-07-27 18:48:25,746 - INFO - Enterprise application "/home/karan/install/apache-tomcat-6.0.16/webapps/myfaces" loaded.
      2008-07-27 18:48:25,746 - INFO - Assembling app: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces
      2008-07-27 18:48:25,746 - ERROR - Application cannot be deployed as it contains deployment-ids which are in use: app: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces
      2008-07-27 18:48:25,746 - DEBUG - DeploymentId already used: GreeterImpl
      2008-07-27 18:48:25,746 - DEBUG - DeploymentId already used: MathCalculator
      2008-07-27 18:48:25,747 - ERROR - Unable to deploy collapsed ear in war /myfaces: Exception: Application cannot be deployed as it contains deployment-ids which are in use: app: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces
      GreeterImpl
      MathCalculator
      org.apache.openejb.DuplicateDeploymentIdException: Application cannot be deployed as it contains deployment-ids which are in use: app: /home/karan/install/apache-tomcat-6.0.16/webapps/myfaces
      GreeterImpl
      MathCalculator
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:444)
      at org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:241)
      at org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
      at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924)
      at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:516)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
      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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

        Attachments

          Activity

            People

            • Assignee:
              karan_malhi karan singh malhi
              Reporter:
              karan_malhi karan singh malhi
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: