IDEA 13 and JBoss 7 DuplicateServiceException

Hello,

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?

Dave

16:15:50,030 INFO  [org.jboss.as.connector.deployers.jdbc] (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 [org.jboss.msc.service.fail] (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 org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
 at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011446: Failed to add persistence unit service for Default
 at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:383)
 at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
 at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleWarDeployment(PersistenceUnitDeploymentProcessor.java:194)
 at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
 ... 5 more
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.naming.context.java.jboss.fooEntityManagerFactory is already registered
 at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:358)
 ... 9 more


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

3 comments
Comment actions Permalink


I can see a number of similar issues:
https://community.jboss.org/message/621599#621599
https://issues.jboss.org/browse/WFLY-2365
https://issues.jboss.org/browse/JBAS-8879

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)

Regards,
Michael

0
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.

Thanks!

Dave

0
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.

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>foo-services-ejb</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>


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!

Dave
0

Please sign in to leave a comment.