I did some tests and also had a closer look at the JNDI tree.
So the first problem is that the classname of the SessionBean itself is registered in the global JNDI as a org.jboss.ejb3.stateless.StatelessContainer.
When i try to deploy a second copy of this application (just with different settings in persistence.xml) the deployment fails with
javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EJB3,name=de.eyetea.smartea.daosession.CommonDAOBean already registered.
Is there a way to stop JBoss from doing this, or maybe specify a prefix in jboss.xml???
Then the next question would be how to register the LocalHomes in the "java:enc" jndi subtree, so that there will no clashes again.
Any thoughts on this?
10:26:41,843 INFO [StatelessManager] Registration is not done -> stop
10:26:41,843 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=simple.jar
javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EJB3,name=ejb/Test already registered.
if you find a solution mail me at email@example.com
The problem is already discussed in another topic. See also the issue EJBTHREE-352 in JIRA.