Friday, December 29, 2006

Eclipse RCP and Spring: Code Example from Spring Experience 2006

The example that I used during my talk about Spring and Eclipse RCP at The Spring Experience 2006 is now available for download:
I zipped all the projects of my workspace. You just need to have an Eclipse 3.2 target platform installed and the Equinox 3.2 bundles added to it. The workspace includes two launch configs, one for the server (starts an embedded jetty) and one for the client (starts a modified RCP Mail Example application).


Patrick Roumanoff said...

That's great! it's what I have been looking for for a longtime now.

But I have some issues with your zip file:
- there are hardcoded path in the launch config to C:\eclipse-workspaces\springosgi2
- eclipse is complaining that org.osgi.service.startlevel.StartLevel has Access restriction: The type StartLevel is not accessible due to restriction on required library org.eclipse.osgi_3.2.1.R32x_v20060919.jar
from BundleFactoryBean, this may be resolved in a more recent spring-osgi.
- when I run rcp mail example the view creation fail with a "org.springframework.osgi.service.NoSuchServiceException: A service of type 'org.springframework.context.ApplicationContext' matching filter '(org-springframework-context-service-name=org.eclipse.example.rcpmail-springApplicationContext)' could not be found." maybe it's related to the access restriction problem ?

Thanks again for your example.

Martin Lippert said...


Sorry for the hard-coded paths in the launch config. I should take a look at this, should be possible to define relative paths as well.

The access restriction is violated by the Spring OSGi code and not in my hand. But you are right, the code would be cleaner without this violation.

The exception you get seems like to result from a wrong config.ini file. Is the spring-osgi bundle correctly defined there? The point is that the spring bundle needs to be started before the other bundles (especially your application bundle) are started.

Start the client with the -console option and find out if the spring bundle is activated and running.