openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cverdes <cver...@gmail.com>
Subject Re: Error loading agent with Openjpa2
Date Thu, 04 Jun 2009 14:17:57 GMT

I'm using Maven to enhance the beans in compile time, and I launch the junit
test with maven like:
mvn clean compile test

I also launch the test directly with eclipse (right click->run as->Junit
Test) after enhancing the classes. I know they are enhanced because the
.class implements org.apache.openjpa.enhance.PersistenceCapable.

The JVM is 1.6.0_07.

I also have tried with the vm argument:
-javaagent:"C:\Documents and
Settings\cverdes\.m2\repository\org\apache\openjpa\openjpa\2.0.0-SNAPSHOT/openjpa-2.0.0-SNAPSHOT.jar"

But I think that crappy blank space between "Documents and Settings" (thanks
to the brilliant Windows) could be a problem (There won't be the first time
in Java), so I decided to enhance in compiling time (also because of
performance).


Rick Curtis wrote:
> 
> cverdes-
> 
> Please go ahead and open up a JIRA for the NPE. This is a new code that
> was added a late last week. I'm still looking into why
> ProtectionDomain.getCodeSource() can sometimes return null(The javadoc
> just states that it is possible, but doesn't give any reasons). In all of
> my testing it always worked correctly. What JVM are you running on? 
> 
> Also, the user manual [1] was updated for this support. Please let us know
> if any of this is unclear.
> 
> -Rick
> 
> [1]
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_enhance_dynamic
> 
> 
> cverdes wrote:
>> 
>> Hi, Im running a DAO Test (with openjpa-kernel-2.0.0-EA2-SNAPSHOT) in
>> eclipse and with Maven, getting the next exception:
>> 
>> ...
>> Caused by: java.lang.NullPointerException
>> 	at
>> org.apache.openjpa.enhance.InstrumentationFactory.getAgentJar(InstrumentationFactory.java:204)
>> 	at
>> org.apache.openjpa.enhance.InstrumentationFactory.access$200(InstrumentationFactory.java:47)
>> 	at
>> org.apache.openjpa.enhance.InstrumentationFactory$1.run(InstrumentationFactory.java:99)
>> 	at java.security.AccessController.doPrivileged(Native Method)
>> 	at
>> org.apache.openjpa.enhance.InstrumentationFactory.getInstrumentation(InstrumentationFactory.java:87)
>> 	at
>> org.apache.openjpa.enhance.PCEnhancerAgent.loadDynamicAgent(PCEnhancerAgent.java:95)
>> 	at
>> org.apache.openjpa.persistence.PersistenceProviderImpl.loadAgent(PersistenceProviderImpl.java:243)
>> 	at
>> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:91)
>> 	at
>> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:119)
>> 	at
>> org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:55)
>> 	at javax.persistence.Persistence.createFactory(Persistence.java:172)
>> 	... 51 more
>> 
>> 1) I've downloaded the sources and fixed the problem not using the
>> dynamic enhance agent (openjpa.DynamicEnhancementAgent=false), but I
>> couldn't be able to find this parameter in the web, so my first question
>> is: Where can I find updated reference manual or similar documentation?.
>> 
>> 2) I've seen that this error is because
>> InstrumentationFactory.class.getProtectionDomain()== null
>>                 .getCodeSource().getLocation().
>> So, when it does getLocation().getFile() the NullPointerException is
>> throwed. I think this is a bug, and something like (if location!=null)
>> should be in the code.
>> Anyway, Do you know why could be  the code source location null? I would
>> like to test with dynamic enhance as well :p
>> 
>> Thanx a lot and I hope this thread will help in your work.
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Error-loading-agent-with-Openjpa2-tp3024299p3024967.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.


Mime
View raw message