IDEA 13 and JBoss 7 DuplicateServiceException


I have a JBoss 7 based application (jboss-as-7.1.1.Final) that I can build and deploy without issues from the EAR files generated by Maven.  When I try to set up the JBoss Application Server to run from inside of Intellij IDEA 13, I am unable to deploy the application.  I have tried both as an exploded artifact and a regular artifact.  I keep getting the following exception.  I have checked the JBoss configuration for a duplicate name for the fooEntityManagerFactory but am unable to find anything.

Any ideas?


16:15:50,030 INFO  [] (MSC service thread 1-12) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 8.4)
16:15:50,031 INFO  [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016005: Starting Services for CDI deployment: foo-services-ear-1.0-SNAPSHOT.ear
16:15:50,051 INFO  [org.jboss.weld.Version] (MSC service thread 1-12) WELD-000900 1.1.5 (AS71)
16:15:50,155 ERROR [stderr] (MSC service thread 1-10) ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger
16:15:50,166 ERROR [stderr] (MSC service thread 1-7) ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger
16:15:50,322 ERROR [] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.subunit."foo-services-ear-1.0-SNAPSHOT.ear"."foo-services-web.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."foo-services-ear-1.0-SNAPSHOT.ear"."foo-services-web.war".INSTALL: Failed to process phase INSTALL of subdeployment "foo-services-web.war" of deployment "foo-services-ear-1.0-SNAPSHOT.ear"
 at [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$ [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at java.util.concurrent.ThreadPoolExecutor.runWorker( [rt.jar:1.7.0_17]
 at java.util.concurrent.ThreadPoolExecutor$ [rt.jar:1.7.0_17]
 at [rt.jar:1.7.0_17]
Caused by: JBAS011446: Failed to add persistence unit service for Default
 at [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
 ... 5 more
Caused by: org.jboss.msc.service.DuplicateServiceException: Service is already registered
 at org.jboss.msc.service.ServiceRegistrationImpl.setInstance( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl.startInstallation( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceContainerImpl.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceTargetImpl.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceTargetImpl.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceBuilderImpl.install( [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 ... 9 more

16:15:50,490 INFO  [] (MSC service thread 1-5) JBAS011402: Starting Persistence Unit Service 'foo-services-ear-1.0-SNAPSHOT.ear/foo-services-ejb.jar#Default'

Comment actions Permalink

I can see a number of similar issues:

Please try the following:

1) change the name of the service fooEntityManagerFactory to another one (to ensure you haven't a conflict with previous deployments)
2) change the name of the WAR included into the EAR
3) change the context path of the WAR (in the application.xml)


Comment actions Permalink

Sorry about that.  I did do some searching but I must have missed those.

I'll give these ideas a try and see what happens.



Comment actions Permalink

Hi Michael,

Finally got back to this after some other diversions.  Unfortunately these links are interesting but they were not relevant to the problem at hand.  All of the links refer to duplicate application names for web applications.  And renaming the EntityManagerFactory did not help either.

What did fix the issue was to make the EJB jar a provided artifact in the pom.xml for the Web application.


The line "<scope>provided</scope>" causes Maven to not put the EJB jar foo-services-ejb.jar in the WEB-INF/lib for the foo-services-web project.  If that is not present, there is no duplicate persistence.xml and no duplicate EntityManagerFactory and the deploy succeeds.  Intellij doesn't put the foo-services-ejb.jar in the WEB-INF/lib either so the Build Artifacts process works properly.

Hope this helps someone else!


Please sign in to leave a comment.