3 Replies Latest reply on Oct 23, 2012 10:43 AM by Joakim Hansson

    Problems with deploying multiple WAR files sharing common jar files containing persistence units

    Joakim Hansson Newbie

      Hi! I am fairly new to the JBOSS community, and this is likely a beginner mistake (bear with me). I have two web archives (WAR files), made in eclipse, residigin in a common EAR file.

       

      They both use a JPA enables JAR file which contains a persistence.xml in a META-INF directory, and the source code in the src directory. I am using eclipselink, not hibernate.

       

      + testEar

      |

      +--META-INF

      |

      +--overlayservice.war

      |

      +--unityII.war

      |

      +--lib/

          |

          +-- persistenceUnit.jar (which includes an META-INF and a persistence.xml).

       

      Deploying the project works well. It expands as it should in jboss (7.0.1)

       

      The log seems ok, I can see that a persistence.xml is ecnoutnered and read.

       

      50:23,221 INFO  [org.jboss.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for foo

      50:23,239 INFO  [org.jboss.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for foo

      48:46,992 INFO  [org.jboss.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'testEar.ear#foo'

      48:47,059 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

      48:47,076 INFO  [org.jboss.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'testEar.ear/GenerateOverlayService.war#foo'

      And my webservice (located in overlayservice.war) starts allright. And so that the vaadin/gwt based frontend in unityII as well.

       

      However as soon as they touch the persistence layer stored in the persitenceunit.jar file located in the ears lib directory things falls apart. From the looks of it it simply doesnt find the share library once it gets instantiated.

       

      What am I doing wrong here, any suggestions?

       

      I have been wrestling with this for many days now...

      (standalone.conf.bat)

      Revision:

      Boss Bootstrap Environment

       

      BOSS_HOME: C:\Users\Administratör\bin\jboss-as-7.1.0.CR1b

       

       

      Message was edited by: Joakim Hansson Changes spelling mistakes and added revision information.

        • 1. Re: Problems with deploying multiple WAR files sharing common jar files containing persistence units
          Stephen Coy Master

          Your persistence unit is being created twice. It looks like you have persistenceUnit.jar in both testEar and overlayService.war.

           

          And then something in your PU configuration is configured to create the associated database tables, which fails for the second instance of the PU (because the tables were just created by the first instance).

           

          I'm not familiar with EclipseLink so I can't be more specific than that.

          • 2. Re: Problems with deploying multiple WAR files sharing common jar files containing persistence units
            Joakim Hansson Newbie

            Thanks a lot! I found th emultiple occurrence of the persistence.xml which where the cause. I also updated the jboss server to 7.1.1 (brontes). I also followed the instructions at https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7. And then I run in to this problem:

             

            Calling "C:\Users\Administratör\bin\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
            ===============================================================================
            
              JBoss Bootstrap Environment
            
              JBOSS_HOME: C:\Users\Administratör\bin\jboss-as-7.1.1.Final
            
              JAVA: C:\Program Files\Java\jdk1.6.0_30\bin\java
            
              JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.server.default.config=standalone.xml
            
            ===============================================================================
            
            14:44:09,797 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
            14:44:09,965 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
            14:44:10,006 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
            14:44:11,023 INFO  [org.xnio] XNIO Version 3.0.3.GA
            14:44:11,025 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
            14:44:11,034 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
            14:44:11,042 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
            14:44:11,079 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
            14:44:11,098 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
            14:44:11,107 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
            14:44:11,117 INFO  [org.jboss.as.security] (MSC service thread 1-6) JBAS013100: Current PicketBox version=4.0.7.Final
            14:44:11,129 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
            14:44:11,160 INFO  [org.jboss.as.connector] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
            14:44:11,187 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
            14:44:11,188 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
            14:44:11,206 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
            14:44:11,341 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
            14:44:11,380 INFO  [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
            14:44:11,394 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]
            14:44:11,445 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.2.GA
            14:44:11,775 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "postgresql-9.1-902.jdbc4.jar"
            14:44:11,787 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\Administrat÷r\bin\jboss-as-7.1.1.Final\standalone\deployments
            14:44:11,823 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found testEar.ear in deployment directory. To trigger deployment create a file called testEar.ear.dodeploy
            14:44:11,982 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.1)
            14:44:12,096 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /127.0.0.1:4447
            14:44:12,111 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
            14:44:12,210 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/postgres]
            14:44:12,213 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/tms]
            14:44:12,210 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
            14:44:12,273 INFO  [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on /127.0.0.1:9999
            14:44:12,393 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "postgresql-9.1-902.jdbc4.jar"
            14:44:12,404 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "testEar.ear"
            14:44:12,432 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "GenerateOverlayService.war"
            14:44:12,434 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "UnityII.war"
            14:44:13,369 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-5) Class Path entry activation.jar in "/C:/Users/Administrat÷r/bin/jboss-as-7.1.1.Final/standalone/deployments/testEar.ear/GenerateOverlayService.war/WEB-INF/lib/mail-1.4.jar"  does not point to a valid jar for a Class-Path reference.
            14:44:13,679 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry vaadin-6.7.2.jar in "/C:/Users/Administrat÷r/bin/jboss-as-7.1.1.Final/standalone/deployments/testEar.ear/UnityII.war/WEB-INF/lib/beanvalidation-addon-1.0.0.jar"  does not point to a valid jar for a Class-Path reference.
            14:44:13,693 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) JBAS011401: Read persistence.xml for foo
            
            14:44:13,776 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) 
            MSC00001: Failed to start service jboss.module.service."deployment.testEar.ear".main: 
            org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear".main: Failed to load module: deployment.testEar.ear:main
            
              at org.jboss.as.server.moduleservice.ModuleLoadService.start          (ModuleLoadService.java:91)       [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$Worker.runTask             (ThreadPoolExecutor.java:886)     [rt.jar:1.6.0_30]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run                 (ThreadPoolExecutor.java:908)     [rt.jar:1.6.0_30]
              at java.lang.Thread.run                                               (Thread.java:662)                 [rt.jar:1.6.0_30]
            
            Caused by: org.jboss.modules.ModuleNotFoundException: 
            Module org.eclipse.persistence:main is not found in local module loader @6d3f7281 (roots: C:\Users\Administrat÷r\bin\jboss-as-7.1.1.Final\modules)
            
                    at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
                    ... 5 more
            
            14:44:13,807 ERROR [org.jboss.msc.service.fail]
            (MSC service thread 1-8) MSC00001: Failed to start service jboss.module.service."deployment.testEar.ear.GenerateOverlayService.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear.GenerateOverlayService.war".main: Failed to load module: deployment.testEar.ear.GenerateOverlayService.war:main
                    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
                    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
            Caused by: org.jboss.modules.ModuleNotFoundException: Module org.eclipse.persistence:main is not found in local module loader @6d3f7281 (roots: C:\Users\Administrat÷r\bin\jboss-as-7.1.1.Final\modules)
                    at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
                    ... 5 more
            
            14:44:13,796 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.module.service."deployment.testEar.ear.UnityII.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear.UnityII.war".main: Failed to load module: deployment.testEar.ear.UnityII.war:main
                    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]
                    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]
            Caused by: org.jboss.modules.ModuleNotFoundException: Module org.eclipse.persistence:main is not found in local module loader @6d3f7281 (roots: C:\Users\Administrat÷r\bin\jboss-as-7.1.1.Final\modules)
                    at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.addPaths(Module.java:841) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.link(Module.java:1181) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.Module.relinkIfNecessary(Module.java:1207) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:208) [jboss-modules.jar:1.1.1.GA]
                    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
                    ... 5 more
            
            14:44:13,825 INFO  [org.jboss.as] (MSC service thread 1-4) JBAS015951: Admin console listening on http://127.0.0.1:9990
            14:44:13,994 ERROR [org.jboss.as] (MSC service thread 1-4) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 4345ms - Started 179 of 267 services (3 services failed or missing dependencies, 82 services are passive or on-demand)
            14:44:14,194 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "testEar.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.module.service.\"deployment.testEar.ear.UnityII.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.testEar.ear.UnityII.war\".main: Failed to load module: deployment.testEar.ear.UnityII.war:main","jboss.module.service.\"deployment.testEar.ear\".main" => "org.jboss.ms
            c.service.StartException in service jboss.module.service.\"deployment.testEar.ear\".main: Failed to load module: deployment.testEar.ear:main","jboss.module.service.\"deployment.testEar.ear.GenerateOverlayService.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.testEar.ear.GenerateOverlayService.war\".main: Failed to load module: deployment.testEar.ear.GenerateOverlayService.war:main"}}
            14:44:14,272 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment UnityII.war in 75ms
            14:44:14,317 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment GenerateOverlayService.war in 120ms
            14:44:14,325 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment testEar.ear in 132ms
            14:44:14,330 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
            JBAS014777:   Services which failed to start:      service jboss.module.service."deployment.testEar.ear".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear".main: Failed to load module: deployment.testEar.ear:main
                  service jboss.module.service."deployment.testEar.ear.UnityII.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear.UnityII.war".main: Failed to load module: deployment.testEar.ear.UnityII.war:main
                  service jboss.module.service."deployment.testEar.ear.GenerateOverlayService.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.testEar.ear.GenerateOverlayService.war".main: Failed to load module: deployment.testEar.ear.GenerateOverlayService.war:main
            
            14:44:14,354 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.module.service.\"deployment.testEar.ear.UnityII.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.testEar.ear.UnityII.war\".main: Failed to load module: deployment.testEar.ear.UnityII.war:main","jboss.module.service.\"depl
            oyment.testEar.ear\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.testEar.ear\".main: Failed to load module: deployment.testEar.ear:main","jboss.module.service.\"deployment.testEar.ear.GenerateOverlayService.war\".main" => "org.jboss.msc.service.StartException in service jboss.module.service.\"deployment.testEar.ear.GenerateOverlayService.war\".main: Failed to load module: deployment.testEar.ear.GenerateOverlayService.war:main"}}}}
            

             

            Then I googled a bit on this, but I havent really found a good explanation for the error... Anyone who has an idea? The project structure is till the same...

            • 3. Re: Problems with deploying multiple WAR files sharing common jar files containing persistence units
              Joakim Hansson Newbie

              Ok. I found the error on my own , i had used notepad to edit the module.xml. SUbsequently I missed that the notepad per default created the file with the extension txt... Hmm.... Windows... Well. Its solved :-)