1 2 Previous Next 28 Replies Latest reply: Jun 18, 2012 9:03 AM by Thomas Woelfle Go to original post RSS
  • 15. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master

    Nice! 

     

    I think the first step would be for you to hack together a EclipseLink module to test with.  This would be copied into the as7/modules/org/eclipse/persistence folder.  I have a hack in mind, for the integration classes that I will tell you about when your ready for it.  In a few days, I'll add the hack, if you haven't yet.

     

    You might want to start writing some instructions for how to manually create the as7/modules/org/eclipse/persistence folder as I have done for Hibernate 3 (see https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide).  Just keep the instructions local until they work.

     

    as7/modules/org/eclipse/persistence/main will contain a module.xml file that species the EclipseLink jars and dependencies on other AS7 modules. 

     

    You will want an EclipseLink test that has a persistence.xml with the following property set. 

    <properties>

                <property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence" />

    </properties>

     

    When you get the EclipseLink module hacked together and a test deploying, we should see an error about the adapter module not being found.  I think we will eliminate that error and instead use a simple no-op adapter module (the hack that I mentioned above).  The test case could easily be a test case in as7/testsuite/integration/src/test/java/org/jboss/as/testsuite/integration/jpa (see current Hibernate tests under there).

     

    Make sense?

     

    Scott

  • 16. Re: AS 7 Persistence Provider Problem
    Charles Miller Newbie

    Ok, here is what I've got so far...  Checking in to confirm/deny your last post made sense.

     

    1) Simple module defintion in the as7/modules/org/eclipse/persistence folder - there might be more dependencies but so far it seems the eclipselink jar is pretty much standalone.

     

    <module xmlns="urn:jboss:module:1.0" name="org.eclipse.persistence">

      <resources>

        <resource-root path="eclipselink.jar"/>

            <!-- Insert resources here -->

      </resources>

      <dependencies>

        <module name="javax.api"/>

        <module name="javax.transaction.api"/>

      </dependencies>

    </module>

     

    2) I have taken some notes locally related to how the module was created.  I'm not sure the best way to integrate into documentation.  I guess when things actually work, it should be pretty easy.

     

    3) I've hacked the following classes based upon the Hibernate jpa package.  Basically, everywhere I see "Hibernate", replace with "Eclipselink" -- working through the details for swapping out differences in implementation details for Eclipselink

    <package - structure>

         <integration><jpa>

              <eclipselink>

                   - Employee

                   - SessionFactoryTestCase

                   - SFSB1

                   -SFSBEclipselinkSession

                   -SFSBEclipselinkSessionFactory

     

    Question:

    Does the following properties entry go into the "standalone.xml"? - The Hibernate entry in standalone seems pretty involved - will the entry in the standalone.xml be simular for eclipselink?

     

    <properties>

                <property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence" />

    </properties>

  • 17. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master
    1) Simple module defintion in the as7/modules/org/eclipse/persistence folder - there might be more dependencies but so far it seems the eclipselink jar is pretty much standalone.

     

    <module xmlns="urn:jboss:module:1.0" name="org.eclipse.persistence">

      <resources>

        <resource-root path="eclipselink.jar"/>

            <!-- Insert resources here -->

      </resources>

      <dependencies>

        <module name="javax.api"/>

        <module name="javax.transaction.api"/>

      </dependencies>

    </module>


     

    Looks good.

     

     

     

    2) I have taken some notes locally related to how the module was created.  I'm not sure the best way to integrate into documentation.  I guess when things actually work, it should be pretty easy.

     

     

    Lets talk about the documentation later, that will be as easy as updating a wiki page or posting in this forum.  https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide is easy to update.

     

     

     

    3) I've hacked the following classes based upon the Hibernate jpa package.  Basically, everywhere I see "Hibernate", replace with "Eclipselink" -- working through the details for swapping out differences in implementation details for Eclipselink

    <package - structure>

         <integration><jpa>

              <eclipselink>

                   - Employee

                   - SessionFactoryTestCase

                   - SFSB1

                   -SFSBEclipselinkSession

                   -SFSBEclipselinkSessionFactory

     

    Sounds like a good start.

     

     

    Question:

    Does the following properties entry go into the "standalone.xml"? - The Hibernate entry in standalone seems pretty involved - will the entry in the standalone.xml be simular for eclipselink?

     

    <properties>

                <property name="jboss.as.jpa.providerModule" value="org.eclipse.persistence" />

    </properties>

     

    No, it would be nice to have default properties in "standalone.xml" at some point for things like that. 

     

    I would put all of the desired properties in the persistence.xml (e.g. see org.jboss.as.testsuite.integration.jpa.transaction.TransactionTestCase and examine the String variable named persistence_xml).

     

    Great start! 

  • 18. Re: AS 7 Persistence Provider Problem
    Charles Miller Newbie

    Thank you.

     

    -- This is what I've added to my local stubbed out eclipselink related code so far. 

     

    Within the package "eclipelink" within the "SessionFactoryTestCase"  this is the value of the "persistence_xml"...

     

        private static final String persistence_xml =  

        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +

        "<persistence version=\"1.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_1_0.xsd\">" +

                  "<persistence-unit name=\"mypc\" transaction-type=\"JTA\">" +

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

                            "<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>" +

                            //<mapping-file>META-INF/orm.xml</mapping-file>

                            "<properties>" +

                            //          <!-- <property name="eclipselink.logging.level" value="FINE"/> -->

                            //          <property name="eclipselink.logging.level" value="SEVERE"/>

                                      "<property name=\"eclipselink.target-server\" value=\"JBoss\"/>" +

                                      "<property name=\"eclipselink.weaving\" value=\"static\"/>" +

                            "<property name="eclipselink.target-database" value="Oracle"/>" +

                //          <property name="eclipselink.jdbc.cache-statements" value="true"/>

                //          <property name="eclipselink.jdbc.cache-statements.size" value="0"/>

                //          <property name="eclipselink.jdbc.native-sql" value="true" />

                //          <property name="eclipselink.jdbc.batch-writing" value="None"/>

                //          <property name="eclipselink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>

                          "<property name=\"eclipselink.ddl-generation.output-mode\" value=\"database\"/>" +

                            "</properties>" +

            "</persistence-unit>" +

        "</persistence>";

  • 19. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master

    The needed hack that I mentioned earlier is done and waiting to be merged into the AS7 codebase (https://github.com/jbossas/jboss-as/pull/379).

     

    Once this is merged in, you should be able to sync up with AS7 codebase and the wheels will be a little more greased.

     

    More specifically, when the org.eclipse.persistence.jpa.PersistenceProvider provider classes is used, the org.eclipse.persistence module will be looked up.  The org.eclipse.persistence module files (module.xml + jars) are expected to be in as7/modules/org/eclipse/persistence/main.  I think your last note mentioned the path without "main", so be sure to correct that.

     

    I created a simple (currently ignored) unit test for TopLink that mostly worked (except TopLink couldn't find the JTA transaction manager which causes a unit test failure).  I didn't do the same for EclipseLink.  I'm leaving that for you (which you have mostly done).

     

    After you have synced up with the code changes that I mentioned, we can talk next steps (mostly getting your EclipseLink unit test to pass initially).  I suspect that getting EclipseLink to know about the AS7 JTA transaction manager will be needed.

     

    I could also point you to my github repo, if your anxious to get the hack sooner (I think that http://community.jboss.org/wiki/HackingOnAS7 probably mentions how we can "git cherry-pick" changes between repos).

     

    Scott

  • 20. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master

    The above mentioned changes are merged in.  You can either update your git source or grab tomorrows nightly build (http://community.jboss.org/thread/167590) and continue adding EclipseLink support from there.

  • 21. Re: AS 7 Persistence Provider Problem
    Karsten Wutzke Expert

    What's the status of using EclipseLink with JBoss AS 7 stable versions? How far away is EL on JBAS 7?

     

    Karsten

  • 22. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master

    Karsten,

     

    A few things are going on.  Currently, we are trying to stabilize the AS 7.1 codebase, which means more attention is being spent elsewhere at the moment.  A few people have volunteered to work on the EclipseLink integration but the results of their work has not been shared yet. 

     

    I heard an update privately, a few weeks ago, which I will quote.  "EclipseLink can't find the classes inside the Jar due to the null stream returned from the vfs: URL."

     

    Are you (or anyone else), interested in helping with the integration?

     

    Scott

  • 23. Re: AS 7 Persistence Provider Problem
    prinzm Newbie

    We have not solved our persistence provider problem yet.

     

    What we have done so far:

    1. We extended the HibernatePeristence class and built our own version (because we needed to change the entitynotfounddelegate)

    2. This class was packaged as jar file

    3. A seperate module was created (org/hibernate/custom/main) and the jar was put in this folder

    4. A module.xml was created (resource-root is the jar, depencies are the hibernate files)

    5. We put the following line in the persistence.xml: <property name="jboss.as.jpa.providerModule" value="org.hibernate.custom" />

    6. We removed the <provider> element from the persistence.xml

     

    Finally we started the JBoss Server (AS 7.1 Final), but the deployment never completes - it's just hanging until a timeout error appears.

     

    What have we done wrong? Has the class to be provided in another way?

    We tried to follow this example https://docs.jboss.org/author/display/AS71/JPA+Reference+Guide

     

    Thanks

  • 24. Re: AS 7 Persistence Provider Problem
    Scott Marlow Master

    Did you change the Hibernate jars to expose your CustomHibernatePeristence class instead of the standard HibernatePeristence?  Look at the contents of your fork of the Hibernate entity manager jar for the contents of file META-INF/services/javax.persistence.spi.PersistenceProvider.

     

    You probably didn't change that or add one in your custom jar.  Your custom persistence provider is not a provider, without doing this.

  • 25. Re: AS 7 Persistence Provider Problem
    prinzm Newbie

    Thank you for the advice, I added the file to the jar. Now the server is recognizing the provider, but unfortunately he is missing some hibernate classes (although I added the module org.hibernate as dependency).

    Is there anything else to do?

  • 26. Re: AS 7 Persistence Provider Problem
    Thomas Woelfle Newbie

    Have you found any solution to this problem?

     

    We have almost the same setup. A custom implementation of HibernatePersistence. We've packaged it in the 'ear' file that is deployed but that fails with a 'NoClassDefFoundError' for 'org.hibernate.ejb.HibernatePersistence'.

     

    08:50:14,766 WARN  [org.jboss.modules] (MSC service thread 1-2) Failed to define class my.custom.HibernatePersistence in Module "deployment.ear.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link my/custom/HibernatePersistence (Module "deployment.ear.ear:main" from Service Module Loader)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

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

        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [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:1110) [rt.jar:1.7.0]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

    Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence

        at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0]

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [rt.jar:1.7.0]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391) [jboss-modules.jar:1.1.1.GA]

        ... 15 more

    Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence from [Module "deployment.ear.ear:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

        ... 20 more

     

    08:50:14,789 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."ear.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ear.ear".INSTALL: Failed to process phase INSTALL of deployment "ear.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:1110) [rt.jar:1.7.0]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0]

        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0]

    Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011426: Could not deploy application packaged persistence provider 'my.custom.HibernatePersistence'

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

        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: my.custom.HibernatePersistence from [Module "deployment.ear.ear:main" from Service Module Loader]

        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)

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

        ... 6 more

     

    Any idea what we've done wrong?

     

    Thanks

  • 27. Re: AS 7 Persistence Provider Problem
    Tomaz Cerar Master

    Please create new thread with layout of your application (output of jar tf <name-of-ear>)

     

    it is probably due to missing dependancy to org.hibernate but without more info i cannot be sure

     

     

    --

    tomaz

  • 28. Re: AS 7 Persistence Provider Problem
    Thomas Woelfle Newbie

    Hi Tomaz,

     

    created a new thread https://community.jboss.org/thread/201288

     

    - Thomas

1 2 Previous Next