Note that there are some explanatory texts on larger screens.

plurals
  1. POXPath class resolution in JBoss5
    primarykey
    data
    text
    <p>I'm having a hard time figuring out where the problem is coming from, so I'm posting this in the hopes that others might have found something similar to this elsewhere and are kind enough to share their insight.</p> <p>I'm using a <em>JBoss 5.0.1.GA</em> application server running on top of a <em>Sun Java 1.6.0-13 JDK</em>. For the WAR file in the generated Web Service, I use a <em>Axis2 1.4</em> WS engine whose JAR files are inserted by <em>Eclipse Galileo</em> into the project's <code>WEB-INF/lib</code> directory when creating the Webservice from the given "worker" class in the Dynamic Web Project. The relevant code snippet follows:</p> <pre><code>String sUrl = "http://example.com/datafile.xml"; String sPath = "/some/xpath/string"; InputStream input = new URL(sUrl).openStream(); InputSource source = new InputSource(input); DocumentBuilderFactory docFact = DocumentBuilderFactory.newInstance(); docFact.setNamespaceAware(false); DocumentBuilder parser = docFact.newDocumentBuilder(); Document doc = parser.parse(source); XPath xpath = XPathFactory.newInstance().newXPath(); // error occurs here: String result = (String) xpath.evaluate(path,doc,XPathConstants.STRING); input.close(); </code></pre> <p>This is the error I'm getting from the JBoss log:</p> <blockquote> <p>java.lang.LinkageError: loader constraint violation: when resolving field "STRING" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the referring class, javax/xml/xpath/XPathConstants, and the class loader (instance of &lt;bootloader&gt;) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type</p> </blockquote> <p>I <em>could</em> use the <code>XPath.evaluate(String,Document)</code> &mdash; however there are occasions where I need to get (for example) a <code>XPathConstants.NODESET</code> instead, so it's a no-go. I have also tried to fumble a little by littering some <code>jboss-web.xml</code> files here and there in the WAR file, but with no effect.</p> <p>What I'm trying to understand is:</p> <ul> <li>Where could the error be coming from? The JBoss class loader? Some weird interaction between JBoss and the Sun JDK? Some weirdness introduced by Eclipse when creating the Web Service? Maybe some confusion introduced by the Axis2 libraries deployed within the WAR?</li> <li>I've found instances of compiled class files in what looks like a triple-whammie: <ul> <li>Sun JDK (file <code>rt.jar</code>);</li> <li>JBoss libraries (<code>$JBOSS_HOME/lib/endorsed/stax-api.jar</code>); and </li> <li>Axis2-deployed libraries (<code>$JBOSS_HOME/server/deploy/MyProject.ear/MyProject.war/WEB-INF/lib/axis2-saaj-api-1.4.jar</code> and <code>woden-impl-dom-1.0M8.jar</code>).</li> </ul></li> <li>How exactly am I supposed to configure JBoss to tell it which classes it's OK to load from "other" libraries from? Specifically, the <code>jaxax.xml.namespace.QName</code> is is causing the grief.</li> </ul> <p>Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload