1 2 Previous Next 28 Replies Latest reply on Jun 18, 2012 9:03 AM by woelfle

    AS 7 Persistence Provider Problem

    prinzm

      We wrote our own persistence provider which extends the HibernatePersistence class and used it in the persistence.xml

      Unfortunately on server startup the following exception occurrs:

       

      08:32:08,555 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.subunit."green-ear.ear"."green-ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."green-ear.ear"."green-ejb.jar".INSTALL: Failed to process phase INSTALL of subdeployment "green-ejb.jar" of deployment "green-ear.ear"

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

          at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_25]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_25]

          at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]

      Caused by: java.lang.NullPointerException

          at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addProviderProperties(PersistenceUnitDeploymentProcessor.java:346)

          at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:253)

          at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleJarDeployment(PersistenceUnitDeploymentProcessor.java:115)

          at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:96)

          at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

          ... 5 more

       

      I looked into the source code and found the following entry in the class JPASubSystemAdd:

       

      PersistenceProviderAdapterRegistry.putPersistenceProviderAdaptor(

                              "org.hibernate.ejb.HibernatePersistence", new HibernatePersistenceProviderAdaptor());

       

      So Hibernate is set as the default persistence provider, and I could not find any other location in the code, where a persistence provider ist set. Therefore the method call "PersistenceProviderAdapterRegistry.getPersistenceProviderAdaptor(pu.getPersistenceProviderClassName())" in the method addProviderProperties in the class PersistenceUnitDeploymentProcessor always returns null since no other persistence provider than the default one seems to be registered. Or did I miss something? In JBoss AS 6 this worked as expected.

       

      Thanks!

        • 1. Re: AS 7 Persistence Provider Problem
          smarlow

          This is being changed for AS7-566 (https://issues.jboss.org/browse/AS7-566).  The call to PersistenceProviderAdapterRegistry.putPersistenceProviderAdaptor, will be more dynamic, so that other peristence providers can be accessed.

           

          You could register on AS7-566 for notifications, so you will know when the changes are merged into the AS 7.0.1 master.  Most of the changes are in https://github.com/scottmarlow/jboss-as/commits/master (need more testing).

          • 2. Re: AS 7 Persistence Provider Problem
            guinotphil

            Hi !

             

            I'm not really sure if this is the right place to talk about this, but, I've been trying the hibernate3 provider since the AS7-566 jira has been fixed. I've been using the latest build (July 29th)

             

            As stated, I've added the folowing property to my persistence.xml :

            <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled"/>

             

            And when deploying, I've got the following error:

             

            15:52:58,455 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-13) MSC00001: Failed to start service jboss.deployment.unit."EAR_Project.ear".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."EAR_Project.ear".DEPENDENCIES: Failed to process phase DEPENDENCIES of deployment "EAR_Project.ear"

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]

                at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]

            Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: C:%5CDEV%5Cjboss-as-7.1.0.Alpha1-SNAPSHOT%5Cmodules%5Corg%5Cjboss%5Cas%5Cjpa%5Chibernate3%5Cmain%5Cjboss-as-jpa-hibernate3-7.1.0.Alpha1-SNAPSHOT.jar (Le fichier spécifié est introuvable)

                at org.jboss.as.jpa.processor.JPADependencyProcessor.addHibernate3AdaptorToDeployment(JPADependencyProcessor.java:202)

                at org.jboss.as.jpa.processor.JPADependencyProcessor.loadPersistenceUnits(JPADependencyProcessor.java:148)

                at org.jboss.as.jpa.processor.JPADependencyProcessor.addPersistenceProviderModuleDependencies(JPADependencyProcessor.java:116)

                at org.jboss.as.jpa.processor.JPADependencyProcessor.deploy(JPADependencyProcessor.java:92)

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)

                ... 5 more

            Caused by: java.io.FileNotFoundException: C:%5CDEV%5Cjboss-as-7.1.0.Alpha1-SNAPSHOT%5Cmodules%5Corg%5Cjboss%5Cas%5Cjpa%5Chibernate3%5Cmain%5Cjboss-as-jpa-hibernate3-7.1.0.Alpha1-SNAPSHOT.jar (Le fichier spécifié est introuvable)

                at java.util.zip.ZipFile.open(Native Method) [:1.6.0_22]

                at java.util.zip.ZipFile.<init>(ZipFile.java:114) [:1.6.0_22]

                at java.util.jar.JarFile.<init>(JarFile.java:135) [:1.6.0_22]

                at java.util.jar.JarFile.<init>(JarFile.java:72) [:1.6.0_22]

                at org.jboss.as.jpa.processor.JPADependencyProcessor.addHibernate3AdaptorToDeployment(JPADependencyProcessor.java:190)

                ... 9 more

             

             

            It actually can't find the file C:%5CDEV%5Cjboss-as-7.1.0.Alpha1-SNAPSHOT%5Cmodules%5Corg%5Cjboss%5Cas%5Cjpa%5Chibernate3%5Cmain%5Cjboss-as-jpa-hibernate3-7.1.0.Alpha1-SNAPSHOT.jar

             

            The thing is that actually the file

            C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules\org\jboss\as\jpa\hibernate3\main\jboss-as-jpa-hibernate3-7.1.0.Alpha1-SNAPSHOT.jar

            does exist on my system...

             

            Thank you for your help !

            • 3. Re: AS 7 Persistence Provider Problem
              smarlow

              Please start a new discussion thread next time, so that the original problem is preserved.

               

              Can you verify that  C:\DEV\jboss-as-7.1.0.Alpha1-SNAPSHOT\modules\org\jboss\as\jpa\hibernate3\main\module.xml references dependency on "org.hibernate3" as optional.

               

              http://pastebin.com/JwDT54S2

              • 4. Re: AS 7 Persistence Provider Problem
                swd847

                This looks like a bug with handling windows style path names in the code that automatically adds the hibernate 3 provider to the deployment. I will fix it in upstream today.

                • 5. Re: AS 7 Persistence Provider Problem
                  swd847

                  This should now be fixed in upstream.

                  • 6. Re: AS 7 Persistence Provider Problem
                    subhraroy

                    Hello,

                    I got similar error in 7.0.1. final.

                     

                    Error :

                    16:08:58,078 INFO  [org.jboss.jpa] (MSC service thread 1-7) read persistence.xml for aglite-platform-persistence-unit

                    16:08:58,088 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) added javax.persistence.api, javaee.api, org.jboss.as.jpa, org.javassist dependencies to aglite-nonosgiweb.war

                    16:08:58,089 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) added (default provider) org.hibernate dependency to application deployment (since 1 PU(s) didn't specify jboss.as.jpa.providerModule)

                    16:08:58,089 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) added org.hibernate dependency to application deployment

                    16:08:58,341 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."aglite-nonosgiweb.war".INSTALL

                    : org.jboss.msc.service.StartException in service jboss.deployment.unit."aglite-nonosgiweb.war".INSTALL: Failed to process phase INSTALL of deployment "aglite-nonosgiweb.war"

                            at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)

                            at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)

                            at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

                            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_25]

                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_25]

                            at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]

                    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: only one persistence provider can be packaged with an application [org.eclipse.persistence.jpa.PersistenceProvider, org.eclipse.persistence.jpa.PersistenceProvider]

                            at org.jboss.as.jpa.processor.PersistenceProviderProcessor.deploy(PersistenceProviderProcessor.java:65)

                    ........

                    ........

                     

                    Persistence.xml

                    <persistence-unit name="aglite-platform-persistence-unit" transaction-type="RESOURCE_LOCAL">

                                        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

                    ........

                     

                    Though the provider is added As tried to add hibernate as a dependency and loaded the default provider. Then it tried to process the <provider> and failed with the above error.

                     

                    Please suggest.

                     

                    Regards

                    • 7. Re: AS 7 Persistence Provider Problem
                      smarlow

                      Nightly build that contains the fix  http://community.jboss.org/thread/167590 for the "DeploymentUnitProcessingException: only one persistence provider can be packaged" exception.

                       

                      Are you planning on switching to use Hibernate as the persistence provider?  If no, please describe why not (I'm interested in answers to this question from anyone). 

                       

                      You are not the only one that wants to use EclipseLink but that is not ready yet.  If anyone wants to join in the community effort, to finish the EclipseLink integration.  Please express your interest.

                      • 8. Re: AS 7 Persistence Provider Problem
                        subhraroy

                        Thanks for pointing to the fix.

                         

                        Actually we have a platform that can (supposed to be able to) dynamically create the EntityManagers and can switch between Hibernate / Eclipselink / Ibatis. We manage our own datasources and configure the EMs dynamically depending on the requirement. That means the same application can have more than one EMs and of different providers.

                         

                        We can do that in Tomcat / Jetty / OSGi (Equinox with embedded Tomcat). We are trying to see if that will be possible with JBoss also.

                         

                        I would really like if AS7 provides a way where it does not try to limit an application to a specific provider / datasource.

                         

                        By the way if the persistence.xml is removed(renamed) AS 7 does not throw the exception and configures eclipse.jpa.provider correctly.

                         

                        I am also stuck because AS 7 is forcing the <jta-datasource> / <non-jta-datasource> tag.

                        Any help there would be highly appreciated (though it is out of place in this thread) .

                        • 9. Re: AS 7 Persistence Provider Problem
                          smarlow

                          Try the nightly build mentioned above and report back if the datasource is still forced. 

                           

                          If you are dynamically creating the entity managers, it sounds like you want full control over deployment of the persistence units.

                          • 10. Re: AS 7 Persistence Provider Problem
                            subhraroy

                            Hi,

                             

                            It did not work in 7.1.0.Alpha

                             

                            20:59:49,478 INFO  [org.jboss.as.server.controller] (HttpManagementService-threads - 6) Deployment of "aglite-nonosgiweb.war" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"aglite-nonosgiweb.war#aglite-platform-persistence-unit\" missing [jboss.naming.context.java.com.arisglobal.aglite.datasource.agliteDS ]"]}

                            20:59:49,661 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) Stopped deployment aglite-nonosgiweb.war in 184ms

                             

                            <persistence-unit name="aglite-platform-persistence-unit" transaction-type="RESOURCE_LOCAL">

                                                <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

                             

                            Persistence.xml does not have the <non-jta-datasource>.

                             

                            We want full control over the way persistence units are managed. To give you a context of why we are doing things this way:-

                             

                            We don't have the entity classes specified within our persistence XML file. What we are building is a platform which allows applications to be plugged into it. The entity classes will be pushed at runtime through a Spring bean factory post processor. We also need to allow muliple datasources which could be configured per application/customer (user group). We also create entity managers and transacton managers on the fly based on application/customer configuration.

                             

                            Thus a hardcoded datasource approach won't work for us.

                            • 11. Re: AS 7 Persistence Provider Problem
                              smarlow

                              I'm not sure what you are looking for exactly, but your question(s) probably deserve a separate message thread (http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225).

                              • 12. Re: AS 7 Persistence Provider Problem
                                charleswmiller

                                I am very interested in understanding what I can do to bring EclipseLink support to JBossAS 7.  I have been poking at the Alpha2 code and I think I have at least a vague idea where changes need to be made.  How to make the changes I guess at this point is the $10k question.

                                 

                                Based upon your response, I am trying to get involved with a specific focus to help bring EclipseLink support to the project.

                                 

                                Current Issue:  My local maven build against lastest code is failing on a dependecy on surefire plugin 2.9 test.  This is what I was running into just before typing this message, I hope to be past this problem soon.

                                 

                                What are suggested next step/s?  Suggestions?

                                 

                                Message was edited by: Charles Miller

                                • 13. Re: AS 7 Persistence Provider Problem
                                  smarlow

                                  Glad to have you helping out with the EclipseLink integration! 

                                   

                                  http://community.jboss.org/wiki/HackingOnAS7 might be helpful to read (for information on setting up your build environment and dev process in general). 

                                   

                                  Rather then building AS7 with the "mvn" command, be sure to use the ./build.sh or build.bat file in the AS7 root folder.  Doing a

                                  ./build.sh clean install

                                   

                                    or

                                   

                                  build.bat clean install

                                  should get your build going. 

                                   

                                  Write back when you are past the build issue.

                                  • 14. Re: AS 7 Persistence Provider Problem
                                    charleswmiller

                                    Whooo hooo!!!

                                     

                                    [INFO] ------------------------------------------------------------------------

                                    [INFO] BUILD SUCCESS

                                    [INFO] ------------------------------------------------------------------------

                                    [INFO] Total time: 1:18.105s

                                    [INFO] Finished at: Tue Sep 27 10:02:12 EDT 2011

                                    [INFO] Final Memory: 89M/123M

                                    [INFO] ------------------------------------------------------------------------

                                     

                                    Boy, I looooove my Mac

                                    1 2 Previous Next