You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by garpinc <ga...@yahoo.com> on 2013/07/08 21:23:17 UTC

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Hi.. Is anyone working on this? I'm just getting back to some work that's
dependent on this working and unfortunately my previously working system
broke because the overall platform changed to 1.7 JDK.

Thanks



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584362.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
I found a test case in there actually. But after setting it up and running it
on sun jdk 1.7 and 1.6 there were no issues



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584543.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Nothing in there from what I can tell



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584542.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Rick Curtis <cu...@gmail.com>.
Look at pmr.zip ... I think there might be one in there?


On Thu, Jul 18, 2013 at 3:41 PM, garpinc <ga...@yahoo.com> wrote:

> I didn't see an attached test case..
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584474.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
I didn't see an attached test case..



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584474.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Rick Curtis <cu...@gmail.com>.
Hmm, that looks quite interesting. It might make sense to grab a hold of
that patch and see what if the "hack" makes your problem go away. If so,
you might need to take the testcase that is attached in there and submit a
bug to oracle. I know in the past there have been bugs in the JVM that IBM
fixed, but Sun(pre oracle days) decided to ignore it.


On Thu, Jul 18, 2013 at 1:35 PM, garpinc <ga...@yahoo.com> wrote:

> Incidentally the 2 classes I've seen issues with so far are both enums.. I
> wonder if it has anything to do with
> https://issues.apache.org/jira/browse/OPENJPA-646 referenced as a
> workaround
> in the TemporaryClassLoader
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584467.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Incidentally the 2 classes I've seen issues with so far are both enums.. I
wonder if it has anything to do with
https://issues.apache.org/jira/browse/OPENJPA-646 referenced as a workaround
in the TemporaryClassLoader



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584467.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Rick Curtis <cu...@gmail.com>.
You'd probably have to create your own class transformer and do something
similar to what OpenJPA is.


On Thu, Jul 18, 2013 at 9:19 AM, garpinc <ga...@yahoo.com> wrote:

> Any ideas on how I would get the ClassCircularityError to be raised in a
> test
> case. It's in native java so I'm not sure the circumstances that would
> cause
> it to be raised.
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584463.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Any ideas on how I would get the ClassCircularityError to be raised in a test
case. It's in native java so I'm not sure the circumstances that would cause
it to be raised.



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584463.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Rick Curtis <cu...@gmail.com>.
Create a small standalone test case and open a bug against the JDK[1]?

[1] http://bugs.sun.com/


On Thu, Jul 18, 2013 at 8:14 AM, garpinc <ga...@yahoo.com> wrote:

> Can anyone shed light as to what we'd need to do for next step?
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584460.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Can anyone shed light as to what we'd need to do for next step?



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584460.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Rick Curtis <cu...@gmail.com>.
> 1) jdk 1.7 has a bug OR
> 2) openjpa utilized functionality that was in 1.6 but was a bug fix in 1.7
> and hence openjpa can not depend on the previous behavior
For a point of reference, I believe this all works on IBM JDK 1.6 AND 1.7


On Tue, Jul 16, 2013 at 5:19 PM, garpinc <ga...@yahoo.com> wrote:

> Ok I've found exactly where openjpa operates differently in JDK 1.6 and JDK
> 1.7
>
> Either:
> 1) jdk 1.7 has a bug OR
> 2) openjpa utilized functionality that was in 1.6 but was a bug fix in 1.7
> and hence openjpa can not depend on the previous behavior
>
> Here is the stack trace in 1.6 where ClassCircularityError is raised and
> later caught in PCClassFileTransformer.needsEnhance as a Linkage error on
> line 207 (trunk):
>
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:53304
>         Thread [main] (Suspended (breakpoint at line 36 in LinkageError))
>                 owns: Launcher$AppClassLoader  (id=1166)
>                 ClassCircularityError(LinkageError).<init>(String) line: 36
>                 ClassCircularityError.<init>(String) line: 32
>                 Class<T>.forName0(String, boolean, ClassLoader) line: not
> available
> [native method]
>                 Class<T>.forName(String, boolean, ClassLoader) line: 249
>                 TemporaryClassLoader.loadClass(String, boolean) line: 78
>                 TemporaryClassLoader.loadClass(String) line: 44
>                 Class<T>.forName0(String, boolean, ClassLoader) line: not
> available
> [native method]
>                 Class<T>.forName(String, boolean, ClassLoader) line: 249
>                 PCClassFileTransformer.needsEnhance(String, Class, byte[])
> line: 198
>                 PCClassFileTransformer.transform0(String, Class, byte[])
> line: 139
>                 PCClassFileTransformer.transform(ClassLoader, String,
> Class,
> ProtectionDomain, byte[]) line: 126
>                 TransformerManager.transform(ClassLoader, String, Class,
> ProtectionDomain,
> byte[]) line: 169
>                 InstrumentationImpl.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[], boolean) line: 365
>                 ClassLoader.defineClass1(String, byte[], int, int,
> ProtectionDomain,
> String, boolean) line: not available [native method]
>
> In JDK 1.7 the error is not raised and hence not caught and if you step
> into
> the forName0 you'll instead end up a the following stack position:
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:53419
>         Thread [main] (Suspended)
>                 owns: Object  (id=4827)
>                 String.lastIndexOf(int) line: 1591
>                 Launcher$AppClassLoader.loadClass(String, boolean) line:
> 301
>                 Launcher$AppClassLoader(ClassLoader).loadClass(String)
> line: 357
>                 Class<T>.forName0(String, boolean, ClassLoader) line: not
> available
> [native method]
>                 Class<T>.forName(String, boolean, ClassLoader) line: 270
>                 TemporaryClassLoader.loadClass(String, boolean) line: 78
>                 TemporaryClassLoader.loadClass(String) line: 44
>                 Class<T>.forName0(String, boolean, ClassLoader) line: not
> available
> [native method]
>                 Class<T>.forName(String, boolean, ClassLoader) line: 270
>                 PCClassFileTransformer.needsEnhance(String, Class, byte[])
> line: 198
>                 PCClassFileTransformer.transform0(String, Class, byte[])
> line: 139
>                 PCClassFileTransformer.transform(ClassLoader, String,
> Class,
> ProtectionDomain, byte[]) line: 126
>                 TransformerManager.transform(ClassLoader, String, Class,
> ProtectionDomain,
> byte[]) line: 188
>                 InstrumentationImpl.transform(ClassLoader, String, Class,
> ProtectionDomain, byte[], boolean) line: 424
>                 ClassLoader.defineClass1(String, byte[], int, int,
> ProtectionDomain,
> String) line: not available [native method]
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584443.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>



-- 
*Rick Curtis*

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Ok I've found exactly where openjpa operates differently in JDK 1.6 and JDK
1.7

Either:
1) jdk 1.7 has a bug OR
2) openjpa utilized functionality that was in 1.6 but was a bug fix in 1.7
and hence openjpa can not depend on the previous behavior

Here is the stack trace in 1.6 where ClassCircularityError is raised and
later caught in PCClassFileTransformer.needsEnhance as a Linkage error on
line 207 (trunk):

org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:53304	
	Thread [main] (Suspended (breakpoint at line 36 in LinkageError))	
		owns: Launcher$AppClassLoader  (id=1166)	
		ClassCircularityError(LinkageError).<init>(String) line: 36	
		ClassCircularityError.<init>(String) line: 32	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 249	
		TemporaryClassLoader.loadClass(String, boolean) line: 78	
		TemporaryClassLoader.loadClass(String) line: 44	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 249	
		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 198	
		PCClassFileTransformer.transform0(String, Class, byte[]) line: 139	
		PCClassFileTransformer.transform(ClassLoader, String, Class,
ProtectionDomain, byte[]) line: 126	
		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
byte[]) line: 169	
		InstrumentationImpl.transform(ClassLoader, String, Class,
ProtectionDomain, byte[], boolean) line: 365	
		ClassLoader.defineClass1(String, byte[], int, int, ProtectionDomain,
String, boolean) line: not available [native method]	

In JDK 1.7 the error is not raised and hence not caught and if you step into
the forName0 you'll instead end up a the following stack position:
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:53419	
	Thread [main] (Suspended)	
		owns: Object  (id=4827)	
		String.lastIndexOf(int) line: 1591	
		Launcher$AppClassLoader.loadClass(String, boolean) line: 301	
		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 357	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 270	
		TemporaryClassLoader.loadClass(String, boolean) line: 78	
		TemporaryClassLoader.loadClass(String) line: 44	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 270	
		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 198	
		PCClassFileTransformer.transform0(String, Class, byte[]) line: 139	
		PCClassFileTransformer.transform(ClassLoader, String, Class,
ProtectionDomain, byte[]) line: 126	
		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
byte[]) line: 188	
		InstrumentationImpl.transform(ClassLoader, String, Class,
ProtectionDomain, byte[], boolean) line: 424	
		ClassLoader.defineClass1(String, byte[], int, int, ProtectionDomain,
String) line: not available [native method]	





--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584443.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
New information is that when I set 
jpaConf.put("openjpa.DynamicEnhancementAgent", "false");

I get instead:
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch
target 65 in method
com.cambridgesemantics.xxx.model.AnzoURIToPKImpl.<clinit>()V at offset 56
	at java.lang.Class.forName0(Native Method) ~[na:1.7.0_25]
	at java.lang.Class.forName(Class.java:270) ~[na:1.7.0_25]
	at
org.apache.openjpa.meta.MetaDataRepository.classForName(MetaDataRepository.java:1559)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypesInternal(MetaDataRepository.java:1535)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1513)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.meta.MetaDataRepository.loadPersistentTypes(MetaDataRepository.java:1493)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:141)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:210)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
~[openjpa-2.3.0-20130711.072035-124.jar:2.3.0-SNAPSHOT]


Any ideas here what's happening?




--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584435.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Furthermore I've reverted back to 1.6 JDK with this version of openjpa and it
still works. The difference with jdk 1.6 is that the Instrumentation call
and thus recursion that happens in 1.7 does not occur at that time and the
define completes.

The stack trace in JDK up until the first defineClass1 is as follows after
which execution continues to the next line without a recursive call:
	Launcher$AppClassLoader(ClassLoader).defineClassCond(String, byte[], int,
int, ProtectionDomain, boolean) line: 631	
	Launcher$AppClassLoader(ClassLoader).defineClass(String, byte[], int, int,
ProtectionDomain) line: 615	
	Launcher$AppClassLoader(SecureClassLoader).defineClass(String, byte[], int,
int, CodeSource) line: 141	
	Launcher$AppClassLoader(URLClassLoader).defineClass(String, Resource,
boolean) line: 283	
	URLClassLoader.access$000(URLClassLoader, String, Resource, boolean) line:
58	
	URLClassLoader$1.run() line: 197	
	AccessController.doPrivileged(PrivilegedExceptionAction<T>,
AccessControlContext) line: not available [native method]	
	Launcher$AppClassLoader(URLClassLoader).findClass(String) line: 190	
	Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 306	
	Launcher$AppClassLoader.loadClass(String, boolean) line: 301	
	Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 247	
	H2Dictionary(DBDictionary).configureNamingRules() line: 520	
	H2Dictionary(DBDictionary).setConfiguration(Configuration) line: 4672	
	Configurations.configureInstance(Object, Configuration, Properties, String)
line: 504	
	Configurations.configureInstance(Object, Configuration, String, String)
line: 461	
	DBDictionaryFactory.newDBDictionary(JDBCConfiguration, String, String,
Connection) line: 201	
	DBDictionaryFactory.newDBDictionary(JDBCConfiguration, DataSource, String)
line: 102



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584433.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Kevin Sutter <kw...@gmail.com>.
Thanks for the information, garpinc!  Very helpful information.

Kevin


On Tue, Aug 20, 2013 at 10:45 AM, garpinc <ga...@yahoo.com> wrote:

> Turns out adding jvm option -XX:+AlwaysLockClassLoader appears to resolve
> issue.
>
> From http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html
>
> It says:
> Troubleshooting
> If your product ships and appears to have problems due to incomplete
> handling of critical sections, you can use a new VM flag
> -XX:+AlwaysLockClassLoader. This flag reverts to locking the class loader
> lock before invoking your custom class loader's findClass() or loadClass()
> method, even for class loaders that register as parallel capable.
>
> The correct fix however would be to follow the guidelines in that post.
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584744.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Turns out adding jvm option -XX:+AlwaysLockClassLoader appears to resolve
issue.

>From http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html

It says:
Troubleshooting
If your product ships and appears to have problems due to incomplete
handling of critical sections, you can use a new VM flag
-XX:+AlwaysLockClassLoader. This flag reverts to locking the class loader
lock before invoking your custom class loader's findClass() or loadClass()
method, even for class loaders that register as parallel capable.

The correct fix however would be to follow the guidelines in that post.



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584744.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
Looks to me that PCClassFileTransformer is clicking off a second defineClass
before the first define class is complete. See the code beginning with
"*******". I would seem that you can't enhance a class that hasn't been
defined yet and hence this needs to happen at a later time after the define.

org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:64816	
	Thread [main] (Suspended)	
		owns: Vector<E>  (id=12323)	
		owns: Object  (id=12288)	
		Vector<E>.addElement(E) line: 615	
		Launcher$AppClassLoader(ClassLoader).addClass(Class) line: 263	
*********ClassLoader.defineClass1(String, byte[], int, int,
ProtectionDomain, String) line: not available [native method]	
		Launcher$AppClassLoader(ClassLoader).defineClass(String, byte[], int, int,
ProtectionDomain) line: 792	
		Launcher$AppClassLoader(SecureClassLoader).defineClass(String, byte[],
int, int, CodeSource) line: 142	
		Launcher$AppClassLoader(URLClassLoader).defineClass(String, Resource)
line: 449	
		URLClassLoader.access$100(URLClassLoader, String, Resource) line: 71	
		URLClassLoader$1.run() line: 361	
		URLClassLoader$1.run() line: 355	
		AccessController.doPrivileged(PrivilegedExceptionAction<T>,
AccessControlContext) line: not available [native method]	
		Launcher$AppClassLoader(URLClassLoader).findClass(String) line: 354	
		Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 424	
		Launcher$AppClassLoader.loadClass(String, boolean) line: 308	
		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 357	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 270	
		TemporaryClassLoader.loadClass(String, boolean) line: 78	
		TemporaryClassLoader.loadClass(String) line: 44	
		Class<T>.forName0(String, boolean, ClassLoader) line: not available
[native method]	
		Class<T>.forName(String, boolean, ClassLoader) line: 270	
		PCClassFileTransformer.needsEnhance(String, Class, byte[]) line: 198	
		PCClassFileTransformer.transform0(String, Class, byte[]) line: 139	
		PCClassFileTransformer.transform(ClassLoader, String, Class,
ProtectionDomain, byte[]) line: 126	
		TransformerManager.transform(ClassLoader, String, Class, ProtectionDomain,
byte[]) line: 188	
		InstrumentationImpl.transform(ClassLoader, String, Class,
ProtectionDomain, byte[], boolean) line: 424	
*********ClassLoader.defineClass1(String, byte[], int, int,
ProtectionDomain, String) line: not available [native method]	
		Launcher$AppClassLoader(ClassLoader).defineClass(String, byte[], int, int,
ProtectionDomain) line: 792	
		Launcher$AppClassLoader(SecureClassLoader).defineClass(String, byte[],
int, int, CodeSource) line: 142	
		Launcher$AppClassLoader(URLClassLoader).defineClass(String, Resource)
line: 449	
		URLClassLoader.access$100(URLClassLoader, String, Resource) line: 71	
		URLClassLoader$1.run() line: 361	
		URLClassLoader$1.run() line: 355	
		AccessController.doPrivileged(PrivilegedExceptionAction<T>,
AccessControlContext) line: not available [native method]	
		Launcher$AppClassLoader(URLClassLoader).findClass(String) line: 354	
		Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 424	
		Launcher$AppClassLoader.loadClass(String, boolean) line: 308	
		Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 357	
		H2Dictionary(DBDictionary).configureNamingRules() line: 520	
		H2Dictionary(DBDictionary).setConfiguration(Configuration) line: 4672	
		Configurations.configureInstance(Object, Configuration, Properties,
String) line: 504	
		Configurations.configureInstance(Object, Configuration, String, String)
line: 461	
		DBDictionaryFactory.newDBDictionary(JDBCConfiguration, String, String,
Connection) line: 201	









--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584432.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
I'm trying to understand the code path here:
In trunk
In PCEnhancerAgent on line 98 it says:
premain("", inst);

so no args are passed to premain and I get following stack trace which
results in error:

Thread [main] (Suspended (breakpoint at line 105 in PCClassFileTransformer))	
	owns: Class<T> (org.apache.openjpa.enhance.PCEnhancerAgent) (id=46)	
	PCClassFileTransformer.<init>(MetaDataRepository, PCEnhancer$Flags,
ClassLoader, boolean) line: 105	
	PCClassFileTransformer.<init>(MetaDataRepository, Options, ClassLoader)
line: 67	
	PCEnhancerAgent.registerClassLoadEnhancer(Instrumentation, Options) line:
187	
	PCEnhancerAgent.premain(String, Instrumentation) line: 145	
	PCEnhancerAgent.loadDynamicAgent(Log) line: 98	
	PersistenceProviderImpl.loadAgent(BrokerFactory) line: 303	
	PersistenceProviderImpl.createEntityManagerFactory(String, String, Map)
line: 98	
	
In the config map passed to createEntityManagerFactory I'm passing my types:
openjpa.MetaDataFactory=jpa(Types=...

And I had previously called following which is build time enhancement:
        //run actual enhancer call: Using build time enhancement as per
       
//http://openjpa.apache.org/builds/2.2.0/apache-openjpa/docs/ref_guide_pc_enhance.html#ref_guide_pc_enhance_build
        PCEnhancer.run(ojc, eargs, eflags, null, writer, classLoader);


Despite the config I'm passing it's trying to instantiate a
ClassLoadEnhancer

Can someone please help me since I'm running out of options. I can join on
Skype and share screen so someone who knows can help me resolve problem. To
reiterate this code was all working in JDK 1.6

Thanks



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584390.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
It may pertain to
http://docs.oracle.com/javase/7/docs/technotes/guides/lang/cl-mt.html

"If your custom class loader overrides either the protected
loadClass(String, boolean) method or the public loadClass(String) method,
you must also ensure that the protected defineClass() method is called only
once for each class loader and class name pair."

I don't see how we're ensuring that in TemporaryClassloader



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584609.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
I discovered how to enable the javaagent aspect of the test case. This
allowed me to first replicate the issue referenced in OPENJPA-646 and then I
did the prescribed uncomment in the TemporaryClassLoader that resulted in
the fix. Then I changed the test class to an enum class and I got the
symptoms of OpenJPA-2399 running jdk 1.7. Changing the jdk to 1.6 the
problem went away.



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584608.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
My classes and configuration are dynamic in nature hence there is no
persistence.xml



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584381.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Michael Dick <mi...@gmail.com>.
I had trouble with that too, but wasn't able to get to the bottom of it. If
you enable debug logging you might be able to spot the root cause.

It's a pain for unit testing, but the best approach might be to just list
the classes in persistence.xml with <class> tags.

-mike


On Tue, Jul 9, 2013 at 4:27 PM, garpinc <ga...@yahoo.com> wrote:

> When this executes:
>         EntityManagerFactory preWrappedEntityManagerFactory =
>
> Persistence.createEntityManagerFactory(JPAHelperFactory.getInstance().getPersistenceID(),
> jpaConf);
>
>
> I get:
> 359  jpastor  INFO   [main] openjpa.Enhance - You have enabled runtime
> enhancement, but have not specified the set of persistent classes.  OpenJPA
> must look for metadata for every loaded class, which might increase class
> load times significantly.
> 1600  jpastor  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
> the class enhancer. Any classes that were not enhanced at build time will
> be
> enhanced when they are loaded by the JVM.
> 1600  jpastor  WARN   [main] openjpa.Runtime - OpenJPA dynamically loaded
> the class enhancer. Any classes that were not enhanced at build time will
> be
> enhanced when they are loaded by the JVM.
>
> even though jpaConf has following defined:
> openjpa.MetaDataFactory=jpa(Types=the classes...
>
> Am I missing something?
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584373.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by garpinc <ga...@yahoo.com>.
When this executes:
        EntityManagerFactory preWrappedEntityManagerFactory =
Persistence.createEntityManagerFactory(JPAHelperFactory.getInstance().getPersistenceID(),
jpaConf);


I get:
359  jpastor  INFO   [main] openjpa.Enhance - You have enabled runtime
enhancement, but have not specified the set of persistent classes.  OpenJPA
must look for metadata for every loaded class, which might increase class
load times significantly.
1600  jpastor  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded
the class enhancer. Any classes that were not enhanced at build time will be
enhanced when they are loaded by the JVM.
1600  jpastor  WARN   [main] openjpa.Runtime - OpenJPA dynamically loaded
the class enhancer. Any classes that were not enhanced at build time will be
enhanced when they are loaded by the JVM.

even though jpaConf has following defined:
openjpa.MetaDataFactory=jpa(Types=the classes...

Am I missing something?



--
View this message in context: http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584373.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JDK 1.7 seems to be causing an issue with latest snapshot

Posted by Michael Dick <mi...@gmail.com>.
Looks like the security classloader and the agent enhancer are defining the
same class (with the agent getting there first). Without any clue to which
classes are entities, the agent enhances everything it finds. Anecdotal
evidence suggests that it only takes one persistence unit without a list of
entities to cause the problem.

The logs will have something like this if that's the case:
65  test  INFO   [main] openjpa.Enhance - You have enabled runtime
enhancement, but have not specified the set of persistent classes.  OpenJPA
must look for metadata for every loaded class, which might increase class
load times significantly.

If you're getting this message the easiest workaround is to list your
entities in persistence.xml, or a mapping file. Failing that you can try a
system argument : -Dopenjpa.MetaDataFactory=Types=${list your classes here}
(but I didn't have much luck with this when I tried it).

Or, you could enhance as a build step. This
page<http://openjpa.apache.org/entity-enhancement.html>might help.
Chances are you've already read it, but the next reader might
not have the link.

To automagically resolve this we'd have to make some (significant?) changes
to the agent, and we'd need a JIRA issue, if one hasn't already been opened.

If you can, try listing your entities, or running the enhancer prior to
running your app (and skip the javaagent). If neither works, let us know
and hopefully we'll be able to help.
-Mike



On Mon, Jul 8, 2013 at 2:23 PM, garpinc <ga...@yahoo.com> wrote:

> Hi.. Is anyone working on this? I'm just getting back to some work that's
> dependent on this working and unfortunately my previously working system
> broke because the overall platform changed to 1.7 JDK.
>
> Thanks
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JDK-1-7-seems-to-be-causing-an-issue-with-latest-snapshot-tp7581417p7584362.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>