Issue Details (XML | Word | Printable)

Key: OPENEJB-873
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: karan singh malhi
Reporter: karan singh malhi
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenEJB

Deploying the same ejb in two different webapps causes a DuplicateDeploymentIdException

Created: 27/Jul/08 10:55 PM   Updated: 29/Oct/08 07:28 PM
Return to search
Component/s: tomcat
Affects Version/s: 3.1
Fix Version/s: 3.1

Time Tracking:
Not Specified

Resolution Date: 27/Jul/08 11:34 PM


 Description  « Hide
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)

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #680207 Sun Jul 27 23:33:33 UTC 2008 kmalhi OPENEJB-873 Deploying the same ejb in two different webapps causes a DuplicateDeploymentIdException
FIXED this issue

How it was fixed:-
The moduleId of an EJB module was earlier set to "classes". Changed it to now set the moduleId of
the EJB to have the same name as the context root of the webapp in which the EJB is installed
Files Changed
MODIFY /openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatWebAppBuilder.java

karan singh malhi added a comment - 27/Jul/08 11:34 PM
Revision number: 680207

karan singh malhi made changes - 27/Jul/08 11:34 PM
Field Original Value New Value
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Blevins added a comment - 29/Oct/08 07:28 PM
Added 3.1 to the fixed version so it can show up in the release notes

David Blevins made changes - 29/Oct/08 07:28 PM
Fix Version/s 3.1 [ 12312761 ]