Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Re: EclipseLink 2.0.1 jars...?

On Fri, Feb 26, 2010 at 3:20 PM, Tom Ware <tom.ware@xxxxxxxxxx> wrote:
Hi Magnus,

 What problem is having the javax.persistence classes in eclipselink.jar causing?  Are you trying to use JPA 2.0 functionality?

Well, I think this text from is a bit missleading talking about the EclipseLink 2.0 "complete" jar:


Full functionality - non OSGI

This is the recommended way of getting EclipseLink unless you are using OSGi, or you want to explicitly exclude certain parts of EclipseLink

  • eclipselink
  • javax.persistence (optional - only needed if you are using JPA outside of a Java EE containe

Since I am booting jpa from within Spring, not Jboss, I guess I am using it outside of a JEE container? Spring is managing everything for me. Anyway...

First try:

I replaced ejb-persistence.jar (jpa1 api) from jboss server/default/lib with javax-persistence-2.0.jar , added eclipselink-2.0.1.jar to by WEB-INF/lib, updated orx.xml/persistence.xml and deployed:

[exec] [INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: javax/persistence/Cache
     [exec] [INFO] [talledLocalContainer] at java.lang.Class.getDeclaredMethods0(Native Method)
     [exec] [INFO] [talledLocalContainer] at java.lang.Class.privateGetDeclaredMethods(
     [exec] [INFO] [talledLocalContainer] at java.lang.Class.privateGetPublicMethods(
     [exec] [INFO] [talledLocalContainer] at java.lang.Class.getMethods(
     [exec] [INFO] [talledLocalContainer] at sun.misc.ProxyGenerator.generateClassFile(
     [exec] [INFO] [talledLocalContainer] at sun.misc.ProxyGenerator.generateProxyClass(
     [exec] [INFO] [talledLocalContainer] at java.lang.reflect.Proxy.getProxyClass(
     [exec] [INFO] [talledLocalContainer] at java.lang.reflect.Proxy.newProxyInstance(
     [exec] [INFO] [talledLocalContainer] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.createEntityManagerFactoryProxy(
     [exec] [INFO] [talledLocalContainer] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] ... 164 more
     [exec] [INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: Unexpected error during load of: javax.persistence.Cache, msg=loader constraint violation: loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) previously initiated loading for a different type with name "javax/persistence/Cache"
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(
     [exec] [INFO] [talledLocalContainer] ... 176 more
     [exec] [INFO] [talledLocalContainer] Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) previously initiated loading for a different type with name "javax/persistence/Cache"

This is because eclipselink-jar contains a subset of whats in javax-peristence-2.0.jar 

Second attempt, I removed javax-persistence-2.0.jar

     [exec] [INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: javax.persistence.PersistenceContext
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at
     [exec] [INFO] [talledLocalContainer] at java.lang.ClassLoader.loadClass(
     [exec] [INFO] [talledLocalContainer] ... 153 more 

Third try, added javax-persistence-2.0.jar and stripped eclipselink.jar... success :-)

 eclipselink.jar has some of the javax.persistence classes because although it is the JPA 2.0 reference implementation, it still supports JPA 1.0 and needs some of those classes to maintain that support.

Why isn't it possible to require persistence-api-1.0.jar on the classpath?
 The bundles have no-such issue and for servers that do not explicitly package eclipselink.jar likely provide a good way of avoiding this issue.  If you need help selecting the bundles to use, I can help with that.

I'm ok with it now, thanks. However, I do think that could be a bit more informative.


Back to the top