6 Replies Latest reply on Aug 14, 2013 2:01 AM by seifert

    PersistenceUnitLoadingException after setting up Eclipselink

    seifert

      I followed the How to use EclipseLink with AS7-Tutorial ( https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7#/?page=2 ) to setup JBoss 7.1.1.Final to use Eclipselink 2.5.0:

       

      <dependency>

                <groupId>org.eclipse.persistence</groupId>

                <artifactId>org.eclipse.persistence.jpa</artifactId>

                <version>2.5.0</version>

      </dependency>

       

      Now I am getting the following errors:

       

      14:22:04,349 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."DynamicWebProject.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."DynamicWebProject.war".INSTALL: Failed to process phase INSTALL of deployment "DynamicWebProject.war"
                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(Unknown Source) [rt.jar:1.7.0_25]
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_25]
                at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_25]
      Caused by: java.lang.NoClassDefFoundError: org/eclipse/persistence/exceptions/PersistenceUnitLoadingException
                at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_25]
                at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) [rt.jar:1.7.0_25]
                at java.lang.Class.getConstructor0(Unknown Source) [rt.jar:1.7.0_25]
                at java.lang.Class.getConstructor(Unknown Source) [rt.jar:1.7.0_25]
                at com.zeroturnaround.javarebel.BP.getConstructor(JRebel:389) [jrebel.jar:201307011846]
                at java.lang.Class.getConstructor(Unknown Source) [rt.jar:1.7.0_25]
                at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:77)
                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: java.lang.ClassNotFoundException: org.eclipse.persistence.exceptions.PersistenceUnitLoadingException from [Module "org.eclipse.persistence:main" from local module loader @2dc671b6 (roots: D:\webdev\jboss-as-7.1.1.Final\modules)]
                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
                ... 13 more
      
      
      14:22:04,403 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "DynamicWebProject.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"DynamicWebProject.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"DynamicWebProject.war\".INSTALL: Failed to process phase INSTALL of deployment \"DynamicWebProject.war\""}}
      14:22:04,408 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
      JBAS014777:   Services which failed to start:      service jboss.deployment.unit."DynamicWebProject.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."DynamicWebProject.war".INSTALL: Failed to process phase INSTALL of deployment "DynamicWebProject.war"
      
      
      14:22:04,451 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.deployment.unit.\"DynamicWebProject.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"DynamicWebProject.war\".INSTALL: Failed to process phase INSTALL of deployment \"DynamicWebProject.war\""}}}}
      14:22:04,586 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment DynamicWebProject.war in 168ms
      
      

       

      This is what my persistence.xml looks like:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.0"
                xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
                <persistence-unit name="DynamicWebProject">
                          <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
                            <properties>
                                    <property name="javax.persistence.jtaDataSource" value="java:jboss/datasources/MySQLDS" />
                                    <property name="eclipselink.target-server" value="JBoss"/>
                                    <property name="eclipselink.weaving" value="static"/>
                             </properties>
                </persistence-unit>
      </persistence>
      
      

       

      I would appreciate any effort to help.

        • 1. Re: PersistenceUnitLoadingException after setting up Eclipselink
          smarlow

          I would try with WildFly 8 (http://www.wildfly.org/download/ has Alpha4 available now).  There is a pre-built WF8/modules/system/layers/base/org/eclipse/persistence/main folder that already contains the module.xml and jipijapa-eclipselink integration jar.  You just need to add the actual EclipseLink jars to this same folder and update the module.xml to list the added jars.

           

          The only hack that is needed, is that the -Declipselink.archive.factory=org.jipijapa.eclipselink.JBossArchiveFactoryImpl needs to be hacked into the application startup scripts.

          • 2. Re: PersistenceUnitLoadingException after setting up Eclipselink
            seifert

            Thank you for your answer.

            I really would like to stick with my current JBoss. Is this so hard to do with my version?

            Moreover I do not dare to use an alpha version...

            • 3. Re: PersistenceUnitLoadingException after setting up Eclipselink
              smarlow

              It sounds like your missing an EclipseLink class dependency in your (org.eclipse.persistence) module.xml that you created for the EclipseLink jars.

               

              Also, if you would like the latest bug fixes for JBoss AS 7.x, switch to EAP 6.x.  Although, it doesn't sound like your hitting a bug yet.

              1 of 1 people found this helpful
              • 4. Re: PersistenceUnitLoadingException after setting up Eclipselink
                seifert

                my module.xml looks like this:

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <module xmlns="urn:jboss:module:1.1" name="org.eclipse.persistence">
                 <resources>
                  <resource-root path="org.eclipse.persistence.jpa-2.5.0.jar"/>
                 </resources>
                 <dependencies>
                  <module name="asm.asm"/>
                  <module name="javax.api"/>
                  <module name="javax.persistence.api"/>
                  <module name="javax.transaction.api"/>
                  <module name="javax.validation.api"/>
                  <module name="javax.xml.bind.api"/>
                  <module name="org.antlr"/>
                  <module name="org.apache.commons.collections"/>
                  <module name="org.dom4j"/>
                  <module name="org.javassist"/>
                  <module name="org.jboss.logging"/>
                 </dependencies>
                </module>
                
                • 5. Re: PersistenceUnitLoadingException after setting up Eclipselink
                  smarlow

                  Did you check that the org.eclipse.persistence.jpa-2.5.0.jar file is in the $JBOSS_HOME/modules/org/eclipse/persistence/main folder?  Sometimes people download EclipseLink and the naming is a little different.

                   

                  Also, verify that class org.eclipse.persistence.exceptions.PersistenceUnitLoadingException is in the

                  org.eclipse.persistence.jpa-2.5.0.jar file (jar tf org.eclipse.persistence.jpa-2.5.0.jar | grep org.eclipse.persistence.exceptions.PersistenceUnitLoadingException).

                  .

                  1 of 1 people found this helpful
                  • 6. Re: PersistenceUnitLoadingException after setting up Eclipselink
                    seifert

                    The naming is fine, but there is indeed no org.eclipse.persistence.exceptions.PersistenceUnitLoadingException in the JAR. Shouldn't Eclipselink ship all it needs? I am still clueless how this is to be solved.

                     

                    UPDATE:

                    I was using the wrong JAR for my architecture: With

                    <dependency>

                              <groupId>org.eclipse.persistence</groupId>

                              <artifactId>eclipselink</artifactId>

                              <version>2.4.2</version>

                    </dependency>

                    it works fine now.

                     

                    Thank you very much for your help!