IIRC eclipselink javaagent looks in AppClassLoader for its classes (so of course it fails)
That said if eclipselink add a correct ClassFileTransformer (i think so) through its persistence unit openejb-javaagent (present by default) will add instrumentation at load time. So basically nothing particular to do excepting adding eclipselink to the webapp or tomee/lib. Last thing; jpa api is provided by tomee and shouldn't be add to the webapp or twice to tomee/lib (there are multiple packages of eclipselinks and one without the api) *Romain Manni-Bucau* *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/2/24 smithh032772 <[email protected]> > Yes, i know, old topic, but when I searched google for the exception, it > lead > me to this, so I thought...why not see if I can resolve this issue via what > is mentioned in this thread. :) > > Background: of course, my app is running really really well on TomEE > 1.5.2-snapshot (not the latest version), so today, I 'finally' decided to > attempt to configure dynamic weaving. So, when I added the following to JVM > options/command-line: > > -javaagent:D:\apache-tomee-plus-1.5.2-SNAPSHOT\lib\eclipselink-2.3.2.jar > > tomee was unable to start, and the following was in the stderr log: > > 2013-02-24 07:18:51 Commons Daemon procrun stderr initialized > java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown > Source) > at > sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown > Source) > Caused by: java.lang.NoClassDefFoundError: > javax/persistence/spi/PersistenceUnitInfo > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Unknown Source) > at > > org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializerAgent.initializeFromAgent(JavaSECMPInitializerAgent.java:44) > at > > org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializerAgent.premain(JavaSECMPInitializerAgent.java:39) > ... 6 more > Caused by: java.lang.ClassNotFoundException: > javax.persistence.spi.PersistenceUnitInfo > at java.net.URLClassLoader$1.run(Unknown Source) > at java.net.URLClassLoader$1.run(Unknown Source) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > ... 10 more > Exception in thread "main" > > > Please note the following: > > 1. eclipselink JAR in tomee/lib: > > D:\apache-tomee-plus-1.5.2-SNAPSHOT\lib\eclipselink-2.3.2.jar > > > 2. tomee.xml contains the following: > > <Resource id="jdbc/mcmsJta" type="javax.sql.DataSource"> > JdbcDriver org.apache.derby.jdbc.EmbeddedDriver > JdbcUrl jdbc:derby:D:/javadb/mcms;create=true > UserName mcms > Password mcms > JtaManaged true > jmxEnabled true > InitialSize 10 > MaxActive 100 > MaxIdle 30 > MaxWait 10000 > minIdle 10 > suspectTimeout 60 > removeAbandoned true > removeAbandonedTimeout 180 > timeBetweenEvictionRunsMillis 30000 > jdbcInterceptors=StatementCache(max=128) > </Resource> > > <Resource id="jdbc/mcmsNonJta" type="javax.sql.DataSource"> > JdbcDriver org.apache.derby.jdbc.EmbeddedDriver > JdbcUrl jdbc:derby:D:/javadb/mcms;create=true > UserName mcms > Password mcms > JtaManaged false > jmxEnabled true > InitialSize 10 > MaxActive 20 > MaxIdle 10 > MaxWait 10000 > removeAbandoned true > removeAbandonedTimeout 18000 > </Resource> > > 3. Romain, per what you mentioned in your email below, I 'can' remove > nonJTA, don't need it, but I think when I first started 'using' tomee, I > think it was required for me to have jta and nonjta defined; i don't > remember...sorry. > > 4. i did recognize the following file in tomee/lib; if I have a > javax.persistance.jar file that was bundled with eclipselink (ZIP contains > eclipselink.jar and javax.persistance.jar, separately), should I remove the > following file from tomee/lib? > > openejb-jpa-integration-4.5.2-SNAPSHOT.jar > > it's not a necessity for me to do dynamic weaving, but i wanted to see how > it impacts my app (and performance, of course). > > please advise. > > thanks, > Howard > > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/tomee-eclipselink-NoClassDefFoundError-ClassNotFoundException-tp4658870p4660999.html > Sent from the OpenEJB User mailing list archive at Nabble.com. >
