[
https://issues.apache.org/jira/browse/OPENJPA-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Curtis updated OPENJPA-1119:
---------------------------------
Attachment: OPENJPA-1119.PATCH
Refactored code for a more 'complete' fix. This new patch fixes the NPE, but
also does some additional manifest validation.
If it is determined that the InstrumentationFactory was loaded from a jar file,
that jar file is opened up and the manifest is examined. If the
InstrumentationFactory is defined as the Agent-Class, we will go ahead and use
that as an argument to the attach api. If the InstrumentationFactory isn't
defined as the Agent-Class, we will go off and create a temporary file.
Currently the openjpa-all.xxxx.jar and openjpa-kernal.xx.jar files do not have
the InstrumentationFactory defined as the Agent-Class and I will address that
issue in OPENJPA-1117. I can hypothesize that the InstrumentationFactory could
be loaded from a jar that doesn't have the Agent-Class defined if a user were
to repackage OpenJPA and not properly copy the manifest attributes over.
While testing this patch I uncovered 33 new test failures when running on Sun
1.6. After looking closer at the failures, most of the tests are named
TestUnenhancedxxxxx. After looking at the commit comment for OPENJPA-293, it
appears that it was known that these tests would fail when using redefinition.
Now that it is possible to use redefinition, these tests are failing. Since it
appears [1] that we are going to disable support for the
redefinition(subclassing) I am going to exclude these failing tests from the
build. Three other tests are also failing due to the dynamic enhancer, so I am
excluding those tests also.
I also updated the openjpa-persistence-jdbc/pom.xml and added
-XX:MaxPermSize=256m to the test.jvm.arguments to take care of the Sun PermGen
OOM problems that I run into when running on Sun 1.6.
[1]http://n2.nabble.com/-VOTE--Turn-off-enhancement-by-subclassing-as-the-default-td1616140.html#a2950000
> NPE in InstrumentationFactory
> -----------------------------
>
> Key: OPENJPA-1119
> URL: https://issues.apache.org/jira/browse/OPENJPA-1119
> Project: OpenJPA
> Issue Type: Bug
> Components: kernel
> Affects Versions: 2.0.0
> Reporter: Rick Curtis
> Assignee: Rick Curtis
> Fix For: 2.0.0
>
> Attachments: OPENJPA-1119.PATCH, OPENJPA-1119.patch
>
>
> As reported in the dev forum [1]
> InstrumentationFactory.class.getProtectionDomain().getCodeSource() returns
> null, causing a NPE.
> 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] http://n2.nabble.com/Error-loading-agent-with-Openjpa2-td3024299.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.