title: How to deal with LinkageErrors in Java?
body: <p>Developing a heavily XML-based Java-application, I recently encountered an interesting problem on Ubuntu Linux.</p>
  
  <p>My application, using the <a href="http://jpf.sourceforge.net/" rel="noreferrer">Java Plugin Framework</a>, appears unable to convert a <a href="http://www.dom4j.org/" rel="noreferrer">dom4j</a>-created XML document to <a href="http://xmlgraphics.apache.org/batik/" rel="noreferrer">Batik's</a> implementation of the SVG specification.</p>
  
  <p>On the console, I learn that an error occurs:</p>
  
  <pre>
  Exception in thread "AWT-EventQueue-0" java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.batik.dom.svg.SVGOMDocument.createAttribute(Ljava/lang/String;)Lorg/w3c/dom/Attr;" the class loader (instance of org/java/plugin/standard/StandardPluginClassLoader) of the current class, org/apache/batik/dom/svg/SVGOMDocument, and the class loader (instance of &lt;bootloader&gt;) for interface org/w3c/dom/Document have different Class objects for the type org/w3c/dom/Attr used in the signature
      at org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(SVGDOMImplementation.java:149)
      at org.dom4j.io.DOMWriter.createDomDocument(DOMWriter.java:361)
      at org.dom4j.io.DOMWriter.write(DOMWriter.java:138)
  </pre>
  
  <p>I figure that the problem is caused by a conflict between the original classloader from the JVM and the classloader deployed by the plugin framework.</p>
  
  <p>To my knowledge, it's not possible to specify a classloader for the framework to use. It might be possible to hack it, but I would prefer a less aggressive approach to solving this problem, since (for whatever reason) it only occurs on Linux systems.</p>
  
  <p>Has one of you encountered such a problem and has any idea how to fix it or at least get to the core of the issue?</p>