Jboss 5 - InstanceAlreadyExistsException - already registere
wasu May 28, 2009 4:27 PMI am using JBoss 5.1.0 and EJB 3.0. Before I used JBoss 4.2.2 where the following error did not happen.
I am using a base.jar which contains reusable code (Stateless and Entity Beans). So I include the base.jar in some other application-jar-archives:
The base-app.jar and the base-session-app.jar include the base.jar and have both the following structure, the deployment descriptors however are different:
/META-INF
/META-INF/ejb-jar.xml
/META-INF/orm.xml
/META-INF/persistence.xml
/base.jar
First I deploy the base-app.jar. When I then deploy the base-session-app.jar, I get the following deployment error:
ERROR [EJBModule] Could not create JSR-77 EJBModule: base.jar javax.management.InstanceAlreadyExistsException: jboss.management.local:j2eeType=EJBModule,J2EEServer=Local,J2EEApplication=null,name=base.jar already registered.
However after this error I can access the stateless session beans of both deployments, of base-app.jar and of base-session-app.jar.
I deploy only statless session beans and entity beans. I have no @Stateless, no @Remote and no @Entity annotations in the source code, I am using the deployment descriptors so that I can load exaclty those EJBs what I want.
The ejb-jar.xml in base-app.jar/META-INF is:
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <enterprise-beans> <session> <ejb-name>UserEntityHandler</ejb-name> <business-remote>pte.base.users.user.IUserEntityHandlerRemote</business-emote> <ejb-class>pte.base.baseasc.users.user.UserEntityHandler</ejb-class> <session-type>Stateless</session-type> </session> ... </enterprise-beans>
The ejb-jar.xml in base-session-app.jar/META-INF/ is:
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <enterprise-beans> <session> <ejb-name>WebSessionClientHandler</ejb-name> <business-remote>pte.base.sessions.IWebSessionClientHandlerRemote</business-remote> <ejb-class>pte.base.baseasc.sessions.WebSessionClientHandler</ejb-class> <session-type>Stateless</session-type> </session> </enterprise-beans>
I have found some similar problems in this forum with the comment that in JBoss 5 this should be solved. Sorry if this issue has often been discussed before, but I did not found an answer concerning JBoss5.
Does anyone have an idea why this error happens?
Is this really an error (as I said, I can access the beans of both deployments)?