1

I have a server based component wired up using Spring. I have a client interface that also uses Spring to connect to the server. I need to connect to the server from an Eclipse RCP application.

I have included the required spring libraries in my target platform.

However, when I try to create the Spring context, I get a ClassNotFoundException on "net.sf.cglib.proxy.Enhancer" which results in an IllegalStateException being thrown.

I have manually wrapped cglib 2.2 in a plugin and added that to my target platform, but it still throws the same error.

How do I ensure the Spring modules have access to CGLib?

  • Have you tried wrapping cglib inside your actual application bundle with it on the BundleClasspath? ie. not in a separate bundle. And embedding it using (Embed-Dependency). Or you can import all of the cglib library (using Private-Import) and ensure that the package shows in the bundle/jar. – Tony Day Nov 24 '11 at 08:48
  • Also, if you have multiple bundles, ensure that the actual bundle that needs cglib is importing it. I made this mistake recently with an Hibernate bundle and a database driver (see http://stackoverflow.com/questions/8013205/osgi-with-hibernate-no-suitable-driver-found). I think its easy to get confused when you're used to Java's standard class loading. – Tony Day Nov 24 '11 at 08:55

1 Answers1

0

I resolved this in by creating a separate bundle containing Spring and all the required dependencies. I then had to add Eclipse-Buddy classloading between my client code and the spring bundle so that it could load my config classes.

Is there a better way?