Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » EasyMock, test plugin and reflection class loading classpath issues.
EasyMock, test plugin and reflection class loading classpath issues. [message #464312] Fri, 02 March 2007 04:55
Barrie Treloar is currently offline Barrie TreloarFriend
Messages: 55
Registered: July 2009
Member
I have my plugin project A, and a separate test plugin project A.test.

In A.test I have a TestCase that is attempting to use EasyMock and the
Class Extension mechanism to create a mock of an existing class.

This fails with the error:
java.lang.NoClassDefFoundError: [Lnet/sf/cglib/proxy/Callback;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1655)
at java.lang.Class.getDeclaredMethod(Class.java:1262)
at net.sf.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java :627)
at net.sf.cglib.proxy.Enhancer.setCallbacksHelper(Enhancer.java :615)
at net.sf.cglib.proxy.Enhancer.setThreadCallbacks(Enhancer.java :609)
at net.sf.cglib.proxy.Enhancer.registerCallbacks(Enhancer.java: 578)
at
org.easymock.classextension.internal.ClassProxyFactory.creat eProxy(ClassProxyFactory.java:99)
at org.easymock.MockControl.<init>(MockControl.java:133)
at
org.easymock.classextension.MockClassControl.<init>(MockClassControl.java:189)
at
org.easymock.classextension.MockClassControl.<init>(MockClassControl.java:194)
at
org.easymock.classextension.MockClassControl.createControl(M ockClassControl.java:36)

I believe the reason for this error is that java.lang.Class is
attempting to use reflection on the class in plugin A and due to
Eclipse's classloading mechanisms the class is not visible.

To verify this, I moved the test class into A's plugin and re-ran the
test and it works fine.

My next step was to try to hack both plugins to have an
Eclipse-BuddyPolicy: global, app, ext, boot, parent, registered

I even tried registering the Test plugin to the project plugin.

None of these work I think because it is the core runtime that needs to
have its classpath modified to see the project plugin's classes via
reflection when called from the test plugin.


I can't find any posts where anyone has tried to use EasyMock with
plugin development.

I've seen Alex's fine post
http://www.eclipsezone.com/articles/eclipse-vms/?source=arch ives about
the vm and classloader but I'm still scratching my head.


Does anyone have any thoughts?

Barrie
Previous Topic:RCP application like eclipse IDE
Next Topic:Run-Time Workbench not available as option under Eclipse Run menu
Goto Forum:
  


Current Time: Thu Apr 25 01:44:14 GMT 2024

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

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

Back to the top