[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: how do i set up plugin dependencies

Raj wrote:
I have four plugin's in my application

1) app
2) springframework
3) apache-commons (commons logging etc)
4) log4j

2,3,4 are setup as dependencies to 1

I am getting a java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory error when i try to load my spring config. Do i have to set up apache commons as a dependecy to spring-framework and log4j as a dependency to apcahe commons and such.


if Plugin 3 requires elements from plugin 2, then plugin 3 needs to import plugin 2. Plugin 3 does not get access to plugin 2 just because plugin 1 requires both 3 and 2.


Since apache commons and logj are available through the class laoder of the main app, and I am trying to initialize spring through my app is there an easy way to tell my spring plugin look at app for any runtime dependencies.


What makes you think apache commons and log4j are available through the class loader of the main app? Have you tested that? Unless those plugins are infact fragments, then they are not. Each plugin gets its own classloader. And even if you import plugin 2 into plugin 1, each class from plugin 2 used within plugin 1 is still loaded by the classloader of plugin 2.




I am trying to underastand the eclipse plugin way of classpath setup, any help is appreciated.


Thanks
Raj


I think I pointed you two 2 bugs. First you need to read the classloading bug from start to finish. Then you would understand this;

You can not use a library that loads classes dynamically such as with Class.ForName by wrapping it in a plugin. If all you want to do is have a seperate plugin for your libraries, the simple solution is to make plugins 2,3,4 as fragments of 1.

Otherwise all loading and usage of classes of the library from plugin 2, would have to be handled exclusively in plugin 2.


CL