Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » [SOLVED] ClassLoader problem : How to specify it ?(A class in a plugin is apparently load through a different ClassLoader then the rest of the classes.)
[SOLVED] ClassLoader problem : How to specify it ? [message #933728] Fri, 05 October 2012 09:31 Go to next message
Eclipse UserFriend
I have been trying to integrate an SVG export in my Eclipse RCP software, but I have a problem when running the code:

!ENTRY org.eclipse.ui 4 0 2012-10-03 16:39:44.835
!MESSAGE Unhandled event loop exception
java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "org/w3c/dom/DOMImplementation"
	at bob.ImageExportUtils.exportAWTasSVG(
	at bob.HeatMapView.widgetSelected(

For running my software and have no problem with external jar files, I inserted all of them in a plugin bob.lib, created using the wizard "Plugin from jar files". This plugin is the only dependencies declared for my bob plugin (excepted of course the different org.eclipse.* plugin always needed)

I first thought that my problem come from the fact that bob.lib plugin contains different type of jar, and maybe two of them have both implemented org.w3c.dom.DOMImplementation, so a conflict is reached has the ClassLoader try to re-load an existing class. But when looking at this plugin and search through Navigate > Open Type, I found only one occurence of this class.

So it is definitely a ClassLoader problem. I admit that the concept of ClassLoader is for me totally virtual (I understand the concept but never go in the deep code). I found one day on a forum someone explaining that you can ask for a class to be loaded by a different ClassLoader than the rest of the project. But I cannot find it today.

So if you have a hint on my problem I would be pleased to hear it !

Thank you.

[Edit] The class org.w3c.dom.DOMImplementation comes from Batik jar (SVG manipulation).

[Updated on: Tue, 16 October 2012 15:06] by Moderator

Report message to a moderator

Re: ClassLoader problem : How to specify it ? [message #946849 is a reply to message #933728] Tue, 16 October 2012 15:05 Go to previous message
Eclipse UserFriend
For those who might be interested, I solved my problem by using another class.

Apprently it was not org.w3c.dom posing problem but org.apache.batik.dom which is loaded when using GenericDOMImplementation in the code:
DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();
Document document = domImpl.createDocument(null, "svg", null);

Both package might use different ClassLoader

In fact, packages needed are now in the TargetPlatform apparently by default (Eclipse 4.2) :

Using these, instead of Batik exported packages solves the problem.

So Batik has a special way of managing ClassLoader ? Is it even possible ?

Anyway it is working, I can do nice figures and that's the principal for me Very Happy
Previous Topic:OSGI-Console for org.eclipse.osgi 3.8.1
Next Topic:Equinox and Declarative Services Annotations
Goto Forum:

Current Time: Mon Dec 06 15:50:16 GMT 2021

Powered by FUDForum. Page generated in 0.02355 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top