-
1. Re: Configure JavaAgent in JBoss to enhance OpenJPA entities
nickarls Dec 18, 2012 2:13 PM (in response to aristides)1 of 1 people found this helpfulAre there indications the agent is picked up? / (forward-slash) is probably better than \\ (double-backslash)
-
2. Re: Configure JavaAgent in JBoss to enhance OpenJPA entities
aristides Dec 21, 2012 7:35 AM (in response to nickarls)Thanks Nicklas, yes changing the "\\" to "/" did seen to make the agent start working,
JAVA_OPTS="$JAVA_OPTS -javaagent:C:/dev/jboss-as-7.1.1.Final/modules/org/apache/openjpa/main/openjpa-all-2.2.0.jars"
Now I´m having problem with the classpath, this agent depends on an couple of jars, like: commons-lang-2.1.jar, geronimo-jpa_3.0_spec-1.0.jar and geronimo-jta_1.1_spec-1.1.jar.
This jars are parte of my module (modules\org\apache\openjpa\main), but I understand that they run in a separate classloader.
If I just run I get a CNFE on a commons-lang class, so I added this libraries using:
JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/a:C:/dev/jboss-as-7.2.0.alpha2/modules/org/apache/openjpa/main/commons-lang-2.1.jar"
So if I do this for all dependencies the CNFE doesn´t appear, but latter on initialization I get a ClassCastException when JBoss is processing the persistence.xml and tries to load the class org.apache.openjpa.persistence.PersistenceProviderImpl.
I think the ClassCastException is caused because the PersistenceProviderImpl appears both in the agent and in the openjpa module.
So my question, Is there a way to make the agent work without affecting the application classloader?