Search code examples
javaeclipseeclipse-rcpclassnotfoundexception

Fail on RCP export, Application class not found


I am running into a java.lang.ClassNotFoundException into my RCP export, that I haven't succeed to resolve. So the context is that I am creating a standalone RCP application and through that i have created a org.eclipse.core.runtime.applications extention.When I launch my Rcp as an eclipse application everything works perfectly as I want, but when I export it, I get this java.lang.ClassNotFoundException. It seems to me that I added the dependencies needed and that my class rule.editor.rcp.Application is okay. This is the error log I get:

!SESSION 2015-09-15 11:24:48.858 -------------------------------------------      ----
eclipse.buildId=unknown
java.version=1.8.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_FR
Framework arguments:  -clearPersistedState
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -clearPersistedState -data C:/Alstom/rule_editor_rcp/rule_editor/workspace

!ENTRY org.eclipse.osgi 2 0 2015-09-15 11:25:04.048
!MESSAGE rule.editor.rcp.Application cannot be found by rule.editor.rcp_1.0.0.201509151120
!STACK 0
java.lang.ClassNotFoundException: rule.editor.rcp.Application cannot be found by rule.editor.rcp_1.0.0.201509151120
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:573)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
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:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

!ENTRY org.eclipse.osgi 4 0 2015-09-15 11:25:04.063
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in rule.editor.rcp was unable to load class rule.editor.rcp.Application.
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:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: java.lang.ClassNotFoundException: rule.editor.rcp.Application cannot be found by rule.editor.rcp_1.0.0.201509151120
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:439)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:352)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:344)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:573)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
... 16 more

Here is my Plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

   <extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="rule.editor.rcp.Application">
     </run>
  </application>
   </extension>
   <extension
        point="org.eclipse.ui.perspectives">
      <perspective
        name="RCP Perspective"
        class="rule.editor.rcp.Perspective"
        id="rule.editor.rcp.perspective">
  </perspective>
   </extension>
   <extension
         id="product_test"
         point="org.eclipse.core.runtime.products">
      <product
            application="rule.editor.rcp.application"
            name="My Product">
         <property
               name="appName"
               value="My Product">
         </property>
         <property
               name="applicationXMI"
               value="rule.editor.rcp/Application.e4xmi">
         </property>
         <property
               name="startupProgressRect"
               value="5,275,445,15">
     </property>
     <property
           name="preferenceCustomization"
           value="plugin_customization.ini">
         </property>
      </product>
   </extension>

</plugin>

And my Manifest.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Rcp
Bundle-SymbolicName: rule.editor.rcp;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: rule.editor.rcp.Activator
Require-Bundle: org.eclipse.debug.core,
 org.eclipse.ui.workbench,
 org.eclipse.debug.ui;bundle-version="3.11.0",
 org.eclipse.core.runtime;bundle-version="3.11.0",
 org.eclipse.e4.core.di.annotations;bundle-version="1.4.0",
 org.eclipse.swt;bundle-version="3.104.0",
 org.eclipse.jface;bundle-version="3.11.0",
 org.eclipse.ui.console;bundle-version="3.6.0",
 org.eclipse.ui.ide;bundle-version="3.11.0",
 com.jcraft.jsch;bundle-version="0.1.51",
 ch.qos.logback.classic;bundle-version="1.0.7",
 com.jscape;bundle-version="1.0.0",
 name.schedenig.eclipse.grepconsole;bundle-version="3.7.0",
 name.schedenig.eclipse.popupnotifications;bundle-version="1.0.0",
 org.drools.eclipse;bundle-version="6.2.0",
 org.eclipse.aether.maven;bundle-version="3.1.0",
 org.jboss.tools.runtime.core;bundle-version="3.1.0",
 org.eclipse.rcp;bundle-version="4.5.0",
 org.eclipse.equinox.p2.publisher;bundle-version="1.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
javax.inject;version="1.0.0",
rule.editor.rcp
Bundle-ActivationPolicy: lazy
Export-Package: rule.editor.rcp

and here is my build.properties:

output.. = bin/
bin.includes = plugin.xml,\
               META-INF/,\
               Application.e4xmi,\
               icons/,\
               plugin_customization.ini,\
               bin/,\
               rule.editor.rcp.product
src.includes = icons/,\
               rule.editor.rcp.product

Also my product configuration is based on plug-ins so all dependencies are in the rule.editor.rcp.product

Here i am, thank you


Solution

  • The build.properties should specify . rather than bin for the class files:

    output.. = bin/
    bin.includes = plugin.xml,\
                   META-INF/,\
                   .,\
                   Application.e4xmi,\
                   icons/,\
                   plugin_customization.ini
    

    Also you don't need the rule.editor.rcp.product file in the includes