0

Plugin A uses a class,ClassB, which is from Plugin B.When "run as eclipse application", everything goes well; however, when PluginA adn Plugin B are exported as Jar, and install into a new eclipse platform, they run well independently, but crash when the codes reach the line where Plugin A uses the ClassB.

error log: ava.lang.NoClassDefFoundError Caused by: java.lang.ClassNotFoundException

In plugin org.jboss.vpe.browsersim.eclipse, there is BrowserSimLauncher.java in the package org.jboss.vep.browsersim.eclipse.launcher;

In plugin org.ayound.js.debug.core, there exits a java file "JsLaunchConfigurationDelegate.java", and I put BrowserSimLauncher.launchBrowserSim(startUrl);

into it, this means I've used previous plugin's class 'BrowserSimLauncher' in the latter plugin.

I also do all the"dependencies things", including adding lines to latter plugin's manifest.mf:

Import-Package: org.jboss.tools.vpe.browsersim.eclipse.launcher

and to previous plugin's manifest.mf:

Export-Package: org.jboss.tools.vpe.browsersim.eclipse.launcher

In the development environment, both plugins compiles successfully, when "run as eclipse application", things goes well, and the latter plugin can sucessfully call BrowserSimLauncher.launchBrowserSim(startUrl); ;
however, when I exported both plugins as several .jar files, and copy them into the /plugin folder of another eclipse directory, start the eclipse, both plugins can run well independently, but the plugin fails to call BrowserSimLauncher.launchBrowserSim(startUrl);. and the error log show as follow:

    !ENTRY org.eclipse.core.jobs 4 2 2015-01-06 16:29:03.817
!MESSAGE An internal error occurred during: "Launching index.html".
!STACK 0
java.lang.NoClassDefFoundError: org/jboss/tools/vpe/browsersim/eclipse/launcher/BrowserSimLauncher
    at org.ayound.js.debug.launch.JsLaunchConfigurationDelegate.launch(JsLaunchConfigurationDelegate.java:101)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException: org.jboss.tools.vpe.browsersim.eclipse.launcher.BrowserSimLauncher cannot be found by org.ayound.js.debug.core_2.2.0
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 6 more

the latter plugin(js.debug.core) can't find the previous plugin(browsersim.eclipse)!

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
cloudyian
  • 141
  • 1
  • 11
  • Start Eclipse specifying the '-clean' option to get it to rebuild the plugin dependencies data. – greg-449 Jan 06 '15 at 09:56
  • oh my! Problem solved! Why.....!! I've spent 2 days on it, and you solve it in two minutes....Anyway, thanks a lot! – cloudyian Jan 06 '15 at 10:15

1 Answers1

0

If you just copy plugins in to the Eclipse 'plugins' directory then you need to specify the '-clean' option when you start Eclipse to get it to rebuild the plugin dependencies cache.

You can specify '-clean' on the Eclipse command line or in the eclipse.ini file (here it must be before any -vmargs line).

It is safe to always specify -clean but it will slow down the Eclipse start a bit.

supplements:

Just startup eclipse with option "-clean", problem solved. Details are from reference article:

What it does:

if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.

How to use it:

  • Edit the eclipse.ini file located in your Eclipse install directory and insert -clean as the first line.
  • Or edit the shortcut you use to start Eclipse and add -clean as the first argument.
  • Or create a batch or shell script that calls the Eclipse executable with the -clean argument. The advantage to this step is you can keep the script around and use it each time you want to clean out the workspace. You can name it something like eclipse-clean.bat (or eclipse-clean.sh).

(From: http://www.eclipsezone.com/eclipse/forums/t61566.html)

Other eclipse command line options: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

Community
  • 1
  • 1
greg-449
  • 109,219
  • 232
  • 102
  • 145