Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » re-factoring rcp application structure (from one bundle to several bundles)
re-factoring rcp application structure [message #677368] Wed, 08 June 2011 06:15 Go to previous message
Luca Ferrari is currently offline Luca Ferrari
Messages: 159
Registered: November 2009
Senior Member
Hi all,
I've developed an RCP application as a single huge plugin, now I'd like to open source it and to make it cleaner, so I decided to split it into different plugins, in order to separate and modularise functionalities and features.
The first step I did was to create a new project, called "WHR.lib" which is a plugin project without an activator and that includes all the jars required by my application. I exported the packages provided by such jars.
In the main project, "WHR.core", I removed all the jars and imported in the required plugins the WHR.lib project, and also added the dependecy to such project int he build path.
However I've got a problem when I launch the application from the plugin.xml:

!SESSION 2011-06-08 12:03:42.149 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_23
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -application WHR.core.application
Command-line arguments:  -application WHR.core.application -data /sviluppo/java/eclipseWorkspace/../runtime-WHR.core.application -dev file:/sviluppo/java/eclipseWorkspace/.metadata/.plugins/org.eclipse.pde.core/WHR.core.application/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 2 0 2011-06-08 12:03:47.208
!MESSAGE The activator whr.rcp.Activator for bundle WHR.core is invalid
!STACK 0
org.osgi.framework.BundleException: The activator whr.rcp.Activator for bundle WHR.core is invalid
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:157)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:238)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	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:368)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.ClassNotFoundException: whr.rcp.Activator
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:150)
	... 23 more
Root exception:
java.lang.ClassNotFoundException: whr.rcp.Activator
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:150)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:751)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:280)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:408)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:238)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	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:368)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

!ENTRY org.eclipse.osgi 4 0 2011-06-08 12:03:47.230
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in WHR.core was unable to load class whr.rcp.Application.
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:180)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:162)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:189)
	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:368)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.ClassNotFoundException: whr.rcp.Application
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:160)
	... 16 more



The system alerts me that there are problems, and the problem view shows me the following:

Description	Resource	Path	Location	Type
classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath)	WHR.core		Unknown	Java Problem



However the lib project exports the org.aspectj.lang package and in the Java editor I don't see any error against the org.aspectj.lang imports. The following an excerpt of theexport section of the WHR.lib MANIFEST.MF

Export-Package: org.aopalliance.aop,
 org.aspectj.lang,


In the classpath section of the WHR.core project (the one I launch) I don't have anything, and I cannot specify the packages of the WHR.lib project. With regard to the running application I've got the following configuration:

<extension
         id="application"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="whr.rcp.Application">
         </run>
      </application>
   </extension>


and the manifest is

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: WHR.core
Bundle-SymbolicName: WHR.core;singleton:=true
Bundle-Version: 0.6.5.alpha
Bundle-Activator: whr.rcp.Activator
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 org.eclipse.core.databinding;bundle-version="1.2.0",
 org.eclipse.jface.databinding;bundle-version="1.3.1",
 org.junit,
 WHR.lib;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: classes/,
 conf/,
 img/



And finally the following is the activator of WHR.core:

public class Activator extends AbstractUIPlugin {

	// The plug-in ID
	public static final String PLUGIN_ID = "WHR.core";

	/**
	 * A global image registry for the application.
	 */
	private ImageRegistry imageRegistry = null;

	// The shared instance

	private static Activator plugin;
	public Activator() {
	}

	@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);

		// clean the registry
		if( this.imageRegistry != null )
			this.imageRegistry.dispose();

		this.imageRegistry = null;
	}

	public static Activator getDefault() {
		return plugin;
	}



	public static ImageDescriptor getImageDescriptor(String path) {
		return imageDescriptorFromPlugin(PLUGIN_ID, path);
	}


	@Override
	public synchronized final ImageRegistry getImageRegistry() {
		// return the value of the this.imageRegistry field
		return this.imageRegistry;
	}


	public synchronized final void setImageRegistry(ImageRegistry imageRegistry) {
		// set the value of the this.imageRegistry field
		this.imageRegistry = imageRegistry;
	}
}



Finally, I've tried to start the application with -clean, but nothing changed.
Anybody has a clue?

Thanks
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:org.eclipse.ui.menus
Next Topic:Add the ProjectExplorer to an Eclipse e4 RCP Application
Goto Forum:
  


Current Time: Sat May 18 17:46:48 EDT 2013

Powered by FUDForum. Page generated in 0.01674 seconds