Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Plugin unable to find class - ClassNotFoundException
Plugin unable to find class - ClassNotFoundException [message #895407] Thu, 12 July 2012 17:52
Stephen McGruer is currently offline Stephen McGruerFriend
Messages: 4
Registered: June 2012
Junior Member
(Apologies if this is in the wrong place, wasn't sure if this is a Memory Analyzer specific issue or a RCP one.)

I'm currently trying to add a drop-in plugin to the Eclipse Memory Analyzer tool, but am having trouble getting my plugin to find it's class when it's built. When built, my plugin's jar looks like:

my_plugin.jar
  /META-INF
    /MANIFEST.MF
  /third_party.jar
  /my_plugin_lib.jar
  /build.properties
  /plugin.xml


My code is contained in my_plugin_lib.jar, which looks like:

my_plugin_lib.jar
  /com
    /example
      /eclipse
        /mat
          /MyPlugin.class


The third_party jar contains some third party code.

My MANIFEST.MF file looks like:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: My Plugin
Bundle-SymbolicName: com.example.eclipse.mat;singleton:=true
Bundle-Version: 0.0.0
Require-Bundle: org.eclipse.mat.api;bundle-version="1.2.0",
  org.eclipse.core.runtime;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: third_party.jar,my_plugin_lib.jar,.
Export-Package: com.example.eclipse.mat,
   com.third_party.etc


My build.properties is:

source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.xml,\
               lib/third_party.jar


And, finally, my plugin.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension id="my_plugin" point="org.eclipse.core.runtime.applications">
     <application
       cardinality="singleton-global"
       thread="main"
       visible="true">
         <run class="com.example.eclipse.mat.MyPlugin" />
     </application>
   </extension>
</plugin>


When I place the my_plugin.jar file under mat/dropins/plugins, and run my application, I just get an error that my class cannot be found:

!SESSION 2012-07-12 10:47:41.423 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -application com.example.eclipse.mat.my_plugin test_heap
Command-line arguments:  -application com.example.eclipse.mat.my_plugin test_heap

!ENTRY org.eclipse.osgi 4 0 2012-07-12 10:47:43.522
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in com.example.eclipse.mat was unable to load class com.example.eclipse.mat.MyPlugin.
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176)
        at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
        at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
        at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.ClassNotFoundException: com.example.eclipse.mat.MyPlugin
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
        at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
        ... 16 more


Does anyone know what I am doing wrong? Previously I have created a successful plugin that had it's sources directly under com/example/eclipse/mat/..., but the way I am doing it now creates a _lib jar. I thought that that shouldn't be a problem, as I include the jar on the ClassPath, but maybe I was wrong?

Thanks for any help,
Stephen
Previous Topic:Enable/Disable menu item in eclipse plugin
Next Topic:[Solved] View listen to combobox selection
Goto Forum:
  


Current Time: Tue Mar 19 08:24:33 GMT 2024

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

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

Back to the top