-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
tiger
-
sparc
-
solaris_8
-
Verified
java.lang.ClassNotFoundException is thrown because the loading
mechanism is looking for org.apache.xpath.jaxp.XPathFactoryImpl
and in Tiger it should be trying to find the package renamed class:
com.sun.org.apache.xpath.jaxp.XPathFactoryImpl.
To reproduce this problem use this program:
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import java.io.*;
import org.xml.sax.*;
public class Simple {
public static void main(String[] args){
Simple app = new Simple();
app.run();
}
public void run(){
Document doc = null;
try {
DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();
df.setNamespaceAware(true);
DocumentBuilder bldr = df.newDocumentBuilder();
doc = bldr.parse("foo.xml");
}
catch (ParserConfigurationException e){
System.err.println("testmodeXPathAPI: " +
" ParserConfigurationException.");
}
catch (SAXException e) {
System.err.println("testmodeXPathAPI: SAXException.");
}
catch (IOException e) {
System.err.println("testmodeXPathAPI: IOException.");
}
try {
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
Element elmt = doc.getDocumentElement();
}
catch (XPathException err) {
System.err.println("runXPathAPI_Q1: XPathException: " +
err.getMessage());
err.printStackTrace();
}
}
}
setenv JAVA_HOME <tiger_location>
set path = ($JAVA_HOME/bin $path)
javac Simple.java
java -cp . Simple
Output:
Factory Impl Name : org.apache.xpath.jaxp.XPathFactoryImpl
runXPathAPI_Q1: XPathException: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
javax.xml.xpath.XPathException: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:61)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:35)
at Simple.run(Simple.java:33)
at Simple.main(Simple.java:10)
Caused by: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:58)
... 3 more
mechanism is looking for org.apache.xpath.jaxp.XPathFactoryImpl
and in Tiger it should be trying to find the package renamed class:
com.sun.org.apache.xpath.jaxp.XPathFactoryImpl.
To reproduce this problem use this program:
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import java.io.*;
import org.xml.sax.*;
public class Simple {
public static void main(String[] args){
Simple app = new Simple();
app.run();
}
public void run(){
Document doc = null;
try {
DocumentBuilderFactory df = DocumentBuilderFactory.newInstance();
df.setNamespaceAware(true);
DocumentBuilder bldr = df.newDocumentBuilder();
doc = bldr.parse("foo.xml");
}
catch (ParserConfigurationException e){
System.err.println("testmodeXPathAPI: " +
" ParserConfigurationException.");
}
catch (SAXException e) {
System.err.println("testmodeXPathAPI: SAXException.");
}
catch (IOException e) {
System.err.println("testmodeXPathAPI: IOException.");
}
try {
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
Element elmt = doc.getDocumentElement();
}
catch (XPathException err) {
System.err.println("runXPathAPI_Q1: XPathException: " +
err.getMessage());
err.printStackTrace();
}
}
}
setenv JAVA_HOME <tiger_location>
set path = ($JAVA_HOME/bin $path)
javac Simple.java
java -cp . Simple
Output:
Factory Impl Name : org.apache.xpath.jaxp.XPathFactoryImpl
runXPathAPI_Q1: XPathException: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
javax.xml.xpath.XPathException: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:61)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:35)
at Simple.run(Simple.java:33)
at Simple.main(Simple.java:10)
Caused by: java.lang.ClassNotFoundException: org/apache/xpath/jaxp/XPathFactoryImpl
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:58)
... 3 more