You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Pierre-Arnaud Marcelot <pa...@marcelot.net> on 2008/06/05 10:23:55 UTC
[Studio] Fixing class loader issues between Eclipse plugins using "Buddy Class Loading"
Hi all,
While I was developing the Apache DS plugin for Apache Directory Studio, I
ran into several class loader issues.
The Apache DS plugin defines a new Log4J appender that is used to display
the logs of an Apache DS server in the a console inside Studio.
In the Apache DS plugin, the Log4J dependency is inherited from the Apache
Directory Studio Jars plugin which contains the Log4J jar dependency and
re-exports it in its MANIFEST.MF file.
The compilation worked fine, but at runtime I had some ClassNotFound
exceptions when I was trying to create a new instance of the Logger.
Basically the problem was that the two plugins (Apache DS and Jars) are not
sharing the same class loader, even if we explicitely re-export the
dependency.
So, the Log4J class in the Jars plugin class loader could not find my
Appender class that was in a separate class loader (the Apache DS plugin
class loader).
After a few researches on google, I finaly found that I had to use the
"Buddy Class Loading" feature of Eclipse to get my code working at runtime.
I though it could be interesting to share the links that helped me solve
this problem if someone working on Studio faces a similar issue.
http://www.eclipsezone.com/eclipse/forums/t61831.html
http://www.eclipsezone.com/articles/eclipse-vms/
Regards,
Pierre-Arnaud
Re: [Studio] Fixing class loader issues between Eclipse plugins using
"Buddy Class Loading"
Posted by Stefan Seelmann <se...@apache.org>.
Hi Pierre-Arnaud,
thanks for sharing your experience and the links.
Regards,
Stefan
Pierre-Arnaud Marcelot schrieb:
> Hi all,
>
> While I was developing the Apache DS plugin for Apache Directory Studio,
> I ran into several class loader issues.
>
> The Apache DS plugin defines a new Log4J appender that is used to
> display the logs of an Apache DS server in the a console inside Studio.
> In the Apache DS plugin, the Log4J dependency is inherited from the
> Apache Directory Studio Jars plugin which contains the Log4J jar
> dependency and re-exports it in its MANIFEST.MF file.
> The compilation worked fine, but at runtime I had some ClassNotFound
> exceptions when I was trying to create a new instance of the Logger.
> Basically the problem was that the two plugins (Apache DS and Jars) are
> not sharing the same class loader, even if we explicitely re-export the
> dependency.
> So, the Log4J class in the Jars plugin class loader could not find my
> Appender class that was in a separate class loader (the Apache DS plugin
> class loader).
>
> After a few researches on google, I finaly found that I had to use the
> "Buddy Class Loading" feature of Eclipse to get my code working at runtime.
>
> I though it could be interesting to share the links that helped me solve
> this problem if someone working on Studio faces a similar issue.
>
> http://www.eclipsezone.com/eclipse/forums/t61831.html
> http://www.eclipsezone.com/articles/eclipse-vms/
>
> Regards,
> Pierre-Arnaud
>
>