0

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

Ismail Sen
  • 571
  • 2
  • 14
  • 27
  • Is the product built using PDE? Does the JAR show up under "Plugin Dependencies" in your Package Explorer? Did you click on "Validate Plug-ins" before running your product? – Jonathan W Nov 19 '13 at 12:52
  • The Jar is not under the Plugin dependencies and when I clik on ADD, i couldn't find the org.springframework.So to fix my problem, i've used Eclipse STS and added the Spring Nature to my project. Now i could find the org.springframework to my Plugin dependencies. – Ismail Sen Nov 20 '13 at 07:39

1 Answers1

0

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.

Jonathan W
  • 3,759
  • 19
  • 20
  • Okay, i see what you are saying here. I 'm back to Eclipse now, i've just dowloaded PDE. So how does it work? so i could find the org.springframework? – Ismail Sen Nov 20 '13 at 15:09
  • The Jar's are not under the Plugin Dependecies, they are under Referenced Library. And yes i always Validate the plugins before the run product – Ismail Sen Nov 20 '13 at 15:14
  • Well, PDE actually comes with STS. When you created a new project, did you create a plug-in project, and are you testing it as an Eclipse Application? – Jonathan W Nov 20 '13 at 15:47
  • I solved my problem : I've created a Plug-in from Existing Jar Archives and i've added the Jar's i needed to run my product. Then i've added this Plugin in the Dependecies tab. Now, i can launch my product with no error ! :) – Ismail Sen Nov 20 '13 at 17:01
  • Good to hear. Did you find my answer helpful, or at least pointed you in the right direction? – Jonathan W Nov 20 '13 at 17:08
  • Well, now i ve better knowledge in some eclipse Error ! NoClassDef and NoSuchMethod... I can now handle those exception ! – Ismail Sen Nov 26 '13 at 07:43