NoClassDefFoundError: org/springframework/web/client/RestClientException in ECLIPSE RCP and SPRINGFRAMEWORK

StackOverflow https://stackoverflow.com/questions/20071718

Question

Hi RCP developers,

I'm facing a problem with my product. When I launch it, i got this :

org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: org/springframework/web/client/RestClientException

Caused by: java.lang.NoClassDefFoundError: org/springframework/web/client/RestClientException

I'm using a REST templates from SPRINGFRAMEWORK to catch the results from a REST API, and i try to display that in a Treeview using JFACE.

All springframewok jar's are correctly added to the project.

Could anyone help please?

Thanks in advance !

Ismail

Was it helpful?

Solution

A NoClassDefFoundError specifies that you had the class available at compile time but missing during runtime. In your case org.springframework.web-3.0.5.RELEASE jar seems to be missing in the classpath. If you still face issues, debug following this :

http://javareferencegv.blogspot.com/2013/10/debugging-javalangnoclassdeffounderror.html

OTHER TIPS

I think you're missing a core concept in Eclipse RCP, and that is OSGi. OSGi is a module system that requires each module (i.e., JAR) to import the dependencies it uses by package. Such entries are found in the JAR's MANIFEST.MF. While they can be manually edited to import these dependencies, usually a tool (such as bnd) makes this much easier to manage.

Eclipse PDE does much of this work for you (and so does adding the Spring project nature), but you need to add any dependencies as plugins (which are also OSGi modules) so that they're visible to the RCP product runner built within Eclipse. Simply adding them to your build classpath will not translate to them being included on a runtime classpath.

When you attempt to run your product / application within Eclipse, make sure you click on the "Validate plug-ins" button to ensure that they are all visible runtime to the target RCP app you're running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top