Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Weaver Throws ClassNotFoundException For Available Classes(EclipseLink 2.3.0)
Weaver Throws ClassNotFoundException For Available Classes [message #716252] Tue, 16 August 2011 19:26 Go to next message
Dave M is currently offline Dave MFriend
Messages: 20
Registered: July 2009
Junior Member
We are seeing the EclipseLink 2.3.0 weaver (static and dynamic) throw ClassNotFoundExceptions for classes that are provably available to be class laoded. As the weaver log output below shows, the ClassNotFoundException for the class com.ios.domain.EntityOne occurs immediately after the weaver finished processing the com.ios.doamin.EntityOne class - which it presumably had to have loaded to do its weaving. I'm pretty sure that the weaver uses a temporary class loader, so perhaps that factors into this problem.

We have tried weaving in place and not, weaving jar files and directory structures. We have tried invoking the weaver using the regular eclipselink.jar as well as the OSGI bundles (in both static and dynamic mode). The same error occurs in all cases.

Before I file a bug report, just wanted to check to see if this problem rings a bell with anyone (known/fixed issue, work arounds, likely causes, etc.).

[EL Finest]: 2011-08-16 12:57:34.034--ServerSession(1068678007)--Thread(Thread[main,5,main])--Begin weaver class transformer processing class [com/ios/domain/EntityOne].
[EL Finest]: 2011-08-16 12:57:34.036--ServerSession(1068678007)--Thread(Thread[main,5,main])--End weaver class transformer processing class [com/ios/doamin/EntityOne].
[EL Finest]: 2011-08-16 12:57:34.037--ServerSession(1068678007)--Thread(Thread[main,5,main])--Begin weaver class transformer processing class [com/ios/domain/EntityTwo].
[EL Warning]: 2011-08-16 12:57:34.039--ServerSession(1068678007)--Thread(Thread[main,5,main])--Weaver encountered an exception while trying to weave class com/ios/domain/EntityTwo.  The exception was: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.ios.domain.EntityOne
[EL Finest]: 2011-08-16 12:57:34.04--ServerSession(1068678007)--Thread(Thread[main,5,main])--java.lang.RuntimeException: java.lang.ClassNotFoundException: com.ios.domain.EntityOne
	at org.eclipse.persistence.internal.libraries.asm.ClassWriter.getCommonSuperClass(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.ClassWriter.getMergedType(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.Frame.merge(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.Frame.merge(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.MethodWriter.visitMaxs(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.MethodAdapter.visitMaxs(Unknown Source)
	at org.eclipse.persistence.internal.jpa.weaving.MethodWeaver.visitMaxs(MethodWeaver.java:152)
	at org.eclipse.persistence.internal.libraries.asm.ClassReader.accept(Unknown Source)
	at org.eclipse.persistence.internal.libraries.asm.ClassReader.accept(Unknown Source)
	at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:93)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveClassTransformer.transform(StaticWeaveClassTransformer.java:86)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.process(StaticWeaveProcessor.java:312)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.performWeaving(StaticWeaveProcessor.java:174)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.start(StaticWeaveAntTask.java:215)
	at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.execute(StaticWeaveAntTask.java:177)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
	at org.apache.tools.ant.Main.runBuild(Main.java:809)
	at org.apache.tools.ant.Main.startAnt(Main.java:217)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)


Thanks,

Dave

Re: Weaver Throws ClassNotFoundException For Available Classes [message #716455 is a reply to message #716252] Wed, 17 August 2011 13:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello Dave,

I'm not familiar with using OSGI, but have you taken a look at the steps required in the demo at:
http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving

Best Regards,
Chris

(no subject) [message #716461 is a reply to message #716252] Wed, 17 August 2011 13:02 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello Dave,

I'm not familiar with using OSGI, but have you taken a look at the steps required in the demo at:
http://wiki.eclipse.org/EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving

Best Regards,
Chris
Re: Weaver Throws ClassNotFoundException For Available Classes [message #716466 is a reply to message #716455] Wed, 17 August 2011 13:50 Go to previous messageGo to next message
Dave M is currently offline Dave MFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Chris-

Yes, I've tried lots of variations, including the one on the wiki page you reference. I see the weaver kick in but then the weaving errors occur.

I worked with Mike K last week to get the dynamic weaver running via Gemini JPA in my environment, but once it started working I get the same weaving errors.

It doesn't seem to matter whether I run the dynamic weaver or the static weaver, whether in OSGI (straight Equinox or Gemini JPA) or not, the error is the same.

I guess I'll go ahead and file a bug report.

Thanks,

Dave
Re: Weaver Throws ClassNotFoundException For Available Classes [message #720490 is a reply to message #716466] Tue, 30 August 2011 17:35 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Odd. What is special about this class? Ensure that all other classes it references are on the classpath.

Do you have other classes that work? What JVM and version are you using?
Can you get the basic JPA examples working?
I would recommend getting it working without OSGi first.



James : Wiki : Book : Blog : Twitter
Re: Weaver Throws ClassNotFoundException For Available Classes [message #799791 is a reply to message #716252] Thu, 16 February 2012 10:11 Go to previous messageGo to next message
Christoph John is currently offline Christoph JohnFriend
Messages: 10
Registered: July 2009
Junior Member
Hi Dave,

is this the bug you created? https://bugs.eclipse.org/bugs/show_bug.cgi?id=365385
There is a similar bug here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=363238

We are also seeing this bug appear. The strange thing is if I change the class body a little, the weaving works. We simply replaced a for-each-loop by a normal for-loop with a variable.

When we disabled weaving, the problem went away. What are the performance implications if we turn weaving off?

Thanks,
Chris.
Re: Weaver Throws ClassNotFoundException For Available Classes [message #800259 is a reply to message #799791] Thu, 16 February 2012 21:47 Go to previous messageGo to next message
Dave M is currently offline Dave MFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Chris-

[I replied earlier in the day but for whatever reason that never showed up here in the forum, so this is a second try. Apologies to all if the earlier reply eventually shows up as a duplicate...]

I reported https://bugs.eclipse.org/bugs/show_bug.cgi?id=355016 which Tom Ware closed because I didn't provide a reproduction case, but it sounds like it could be related or the same issue.

Turning off weaving can be very painful in a variety of ways. The impact somewhat depends on whether you are in a Java SE or Java EE environment. In a Java SE environment, no weaving almost certainly means a significant loss of performance and major adverse impact the heap of your JVMs. For example, you would lose lazy loading on 1:1 and M:1 mappings, which means that those relationships will be eagerly loaded. That's not only going to cause a lot of extra database I/O but it will also cause heap to be consumed by objects you would not otherwise have loaded into the JVM. The development cost of over-coming those consequences will be a further time and money impact.

Weaving also supports change tracking, fetch groups and other internal optimizations, so not using weaving means you lose some of those advantages, as well. For more information, you might look at:

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#What_You_May_Need_to_Know_About_Weaving_JPA_Entities

The bottom line is you want weaving turned on if at all possible.

Dave
Re: Weaver Throws ClassNotFoundException For Available Classes [message #803679 is a reply to message #800259] Tue, 21 February 2012 16:54 Go to previous message
Christoph John is currently offline Christoph JohnFriend
Messages: 10
Registered: July 2009
Junior Member
Hi Dave,

thanks for your reply.
In the meanwhile I have worked around the problem as described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=363238 by replacing my for-each-loop by a normal for-loop with an iterator.

It is a strange error, though. But currently no one seems to be looking at that bug or at https://bugs.eclipse.org/bugs/show_bug.cgi?id=365385 which seems to have a test case.

Cheers,
Chris.
Previous Topic:Maintaining object identity across sessions
Next Topic:How to configure Generation strategy in Dynamic Type?
Goto Forum:
  


Current Time: Thu Nov 14 02:29:25 GMT 2024

Powered by FUDForum. Page generated in 0.03472 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top