0
votes

I have an eclipse plugin and have created and a new Extension point with all setting shown in the link: http://www.vogella.com/tutorials/EclipseExtensionPoint/article.html

Now created a new plugin with an extension using this Extension point, also shown in the link above. Now When I run this in my debug environment, it all works fine BUT when I export both these plugin from Eclipse in to plug-in jar file and use it with my application, it fails.

Here is the code to get plugin info that I got from Eclipse website:

       IExtensionRegistry reg = Platform.getExtensionRegistry();
       IExtensionPoint ep = reg.getExtensionPoint("com.proper.package.ProperExtPointId");
       IExtension[] extensions = ep.getExtensions();
       contributors = new ArrayList();
       for (int i = 0; i < extensions.length; i++) 
       {
          IExtension ext = extensions[i];
          IConfigurationElement[] ce = 
             ext.getConfigurationElements();
          for (int j = 0; j < ce.length; j++) 
          {
             Object obj = ce[j].createExecutableExtension("ProperExtPointClass");
             contributors.add(obj);
          }
       }

The Code fails with in the CoreException: org.eclipse.core.runtime.CoreException: Plug-in TempPlugin5 was unable to load class com.....(This the class that implements the interface of the plugin that has Extension Point) . . Caused by: java.lang.NoClassDefFoundError: com.IInterface

All these setting work fine when run to debug these plugins in Eclipse with all dependent plugins loaded, But fails when exported to be used as plug-in jar in my application.

Tried remotedebugging, the code fails in this line:

Object obj = ce[j].createExecutableExtension("ProperExtPointClass");

I have tried to look for this kind of issue both could not find. I feel I am missing some dependency that is available by Eclispe when Debugging but unavailable when exported plugin to use the full application.

To Sum it all: Plugin1 that has the extension point and Interface. And PLugin2(depends on Plugin1) that uses this Extension point, and implements the interface of the plugin1. according to Stacktrace: Plugin2 is unable to see the Interface of the Plugin1. I have the package of Interface in the "Exported packages" in "runtime" tab of Plugin1.

TIA.

1
Have you tried a clean rebuild, I don't know why, but a lot of the time when I get NoClassDefFoundError something in the build has got borkedjrtapsell
Thanks for the help. yes, I have tried a full clean. I doesn't work.user578219

1 Answers

0
votes

Your plugins probably don't contain the correct dependencies. The dependencies are not checked as carefully when debugging so this issue shows up in the release build.

In your plugin MANIFEST.MF you must use either Require-Bundle to list the plugins you depend on, or you can use Import-Package to list the Java packages you depend on.

You can set these values in the MANIFEST.MF editor on the 'Dependencies' tab.

Also note that if your are including any extra jars in your plugin that they must be listed in the bin.includes section of the build.properties file.