I am try to deploy a jar to an jboss server. It works on my environment. But when I deployed the same jar on another server, i kept getting an error saying that the persistence unit is already registered. There is no other bean using the same name and the same persistence unit name. I tried to restart the server and remove the tmp, work, data directory but still get the same error. here is my error:

ObjectName: jboss.j2ee:service=EJB3,module=wess_jpa.jar

State: FAILED

Reason: java.lang.RuntimeException: javax.management.InstanceAlreadyExistsException: persistence.units:unitName=dses_wess already registered.

This is almost identical to this issue in jboss forum but there is no solution: http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211687#4211687

link|improve this question
Could you please post more of the JBoss log content from the failed deployment? That might provide some additional clues. – mlschechter Oct 9 '10 at 1:00
feedback

2 Answers

You probably have unneccesary datasources defined in XML files in your deploy dir. On my setup it is in {jboss.home}/server/default/deploy.

link|improve this answer
feedback

Make sure you don't have persistence.xml with the same persistenceUnit name in both your jar and in your /deploy directory. I'd also open up any other jars, ears, or wars in the deploy directory and look for duplicate persistenceUnit defenitions.

If your using the "all" configuration, make sure the same artifact is not deployed in both the server/all/farm and server/all/deploy directory.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown