3 Replies Latest reply on Aug 24, 2010 4:25 AM by danwin Branched from an earlier discussion.

    Classloader isolation for JPA API

    danwin

      Hi All,

       

      I need help for a class loader problem too. My error message:

       

      the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, oracle/toplink/essentials/internal/ejb/cmp3/EntityManagerSetupImpl, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, javax/persistence/spi/PersistenceUnitInfo, have different Class objects for the type javax/sql/DataSource used in the signature

       

      As Dick I placed a jboss-web.xml at WEB-INF folder:

       

      <?xml version="1.0" encoding="UTF-8" ?>
      <jboss-web>
          <class-loading java2ClassLoadingCompliance="false">
            <loader-repository>
                org.jboss.classloader.spi.base:BaseClassLoader=jsfsample.war
               <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
            </loader-repository>
           </class-loading>
      </jboss-web>

       

      Without result ! Then I found an article (http://nagpals.com/blog/post.cfm/classloader-conflicts-in-railo-on-jboss, I don't use railo - but anyway) that indicates to write jboss-classloader.xml for JBoss 5.X.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <classloading xmlns="urn:jboss:classloading:1.0"
          name="jsfsample.war"           
          domain="jsfsample"
          export-all="NON_EMPTY"
          import-all="true">
      </classloading>

       

      Again, without result, same error.

       

      Thx,

      Daniel

        • 1. Re: Classloader isolation for JPA API
          jaikiran

          Daniel Winz wrote:

           

          Hi All,

           

          I need help for a class loader problem too. My error message:

           

          the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, oracle/toplink/essentials/internal/ejb/cmp3/EntityManagerSetupImpl, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, javax/persistence/spi/PersistenceUnitInfo, have different Class objects for the type javax/sql/DataSource used in the signature

           

          If you are packaging jars containing javax.sql.* classes and/or javax.persistence.* classes then remove those jars from the application packaging.

          • 2. Re: Classloader isolation for JPA API
            danwin

            When I remove javax/sql/DataSource (i.e. removing jdbc2_0-stdext.jar) from my package I get this warning:

            Starting persistence unit persistence.unit:unitName=#Employee-Details
            Warning]: 2010.08.19 07:53:57.542--java.lang.NullPointerException:  null was thrown on attempt of PersistenceLoadProcessor to load class ...

             

            Does the persistence unit not have access to the AS library?

            • 3. Re: Classloader isolation for JPA API
              danwin

              I see! I don't have to remove the jdbc2_0-stdext.jar but the javax/persistence folder from the toplink-essentials.jar. 

              Then I still get the NullPointerException warning. But it seams to be caused by the "temporary UCL3" classloader,  not by missing classes. I don't have a clue what this "temporary"  classloader is for, but following threads indicate to switch it off:

              http://forums.oracle.com/forums/thread.jspa?threadID=584031
              https://glassfish.dev.java.net/issues/show_bug.cgi?id=3721

              Summerized, to switch the classloader off, I added two toplink properties to my persistence.xml:

              <?xml version="1.0" encoding="UTF-8"?>
              <persistence version="1.0"
              xmlns="http://java.sun.com/xml/ns/persistence">
              <persistence-unit name="Employee-Details">
              <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
              <jta-data-source>java:/jdbc/employee</jta-data-source>
              <properties>
              <property name="toplink.weaving" value="false"/>
              <property name="toplink.logging.level" value="OFF" />          
              </properties>          
              </persistence-unit>
              </persistence>


              Deployment without errors then !