-
1. Re: Classloader isolation for JPA API
jaikiran Aug 20, 2010 1:42 PM (in response to danwin)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 Aug 23, 2010 2:36 AM (in response to jaikiran)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 Aug 24, 2010 4:25 AM (in response to 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 !