jaxp 1.4 on jre 1.4.2

M

Matt Rose

Dear all,

I am trying to use the jaxp 1.4 standalone download from java.net with
Sun JRE 1.4.2. Here is a minimal test class:

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;

public class TestJaxp {
public static void main(String[] args) throws Exception {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.evaluate("/", doc);
}
}

It fails with:

java.lang.NoClassDefFoundError: com/sun/org/apache/xalan/internal/
extensions/ExpressionContext
at
com.sun.org.apache.xpath.internal.jaxp.XPathImpl.eval(XPathImpl.java:
201)
at
com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:
275)
at
com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:
365)
at TestJaxp.main(TestJaxp.java:13)
Exception in thread "main"

My classpath consists of this class followed by jaxp-api.jar then jaxp-
ri.jar.

What am I doing wrong?

Thanks,

Matt
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Matt said:
I am trying to use the jaxp 1.4 standalone download from java.net with
Sun JRE 1.4.2. Here is a minimal test class:

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;

public class TestJaxp {
public static void main(String[] args) throws Exception {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.evaluate("/", doc);
}
}

It fails with:

java.lang.NoClassDefFoundError: com/sun/org/apache/xalan/internal/
extensions/ExpressionContext
My classpath consists of this class followed by jaxp-api.jar then jaxp-
ri.jar.

Have you read http://java.sun.com/webservices/jaxp/reference/faqs/index.html
question 14 ?

Arne
 
M

Matt Rose

Matt said:
I am trying to use the jaxp1.4 standalone download from java.net with
Sun JRE 1.4.2. Here is a minimal test class:
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
public class TestJaxp {
public static void main(String[] args) throws Exception {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.evaluate("/", doc);
}
}
It fails with:
java.lang.NoClassDefFoundError: com/sun/org/apache/xalan/internal/
extensions/ExpressionContext
My classpath consists of this class followed by jaxp-api.jar then jaxp-
ri.jar.

Have you readhttp://java.sun.com/webservices/jaxp/reference/faqs/index.html
question 14 ?

Arne

I hadn't read that but I don't think it addresses my problem. I tried
fiddling with the settings as described and set it to both explicitly
use the jaxp xerces implementation (which it was doing by default) and
the JRE crimson implementation but received the same error on each
occasion.

The problem goes away if I execute it with a 1.5 JRE.

Matt
 
M

Matt Rose

Matt said:
I am trying to use the jaxp1.4 standalone download from java.net with
Sun JRE 1.4.2. Here is a minimal test class:
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
public class TestJaxp {
public static void main(String[] args) throws Exception {
Document doc = DocumentBuilderFactory.newInstance()
.newDocumentBuilder().newDocument();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.evaluate("/", doc);
}
}
It fails with:
java.lang.NoClassDefFoundError: com/sun/org/apache/xalan/internal/
extensions/ExpressionContext
My classpath consists of this class followed byjaxp-api.jar thenjaxp-
ri.jar.
Have you readhttp://java.sun.com/webservices/jaxp/reference/faqs/index.html
question 14 ?

I hadn't read that but I don't think it addresses my problem. I tried
fiddling with the settings as described and set it to both explicitly
use thejaxpxerces implementation (which it was doing by default) and
the JRE crimson implementation but received the same error on each
occasion.

The problem goes away if I execute it with a 1.5 JRE.

Matt

For the record, this is a bug in the packaging of the 1.4.1 release
that omitted a few classes needed to run on JRE1.4, one of which is
ExpressionContext. The JAXP folks are aware of it and I believe a fix
is likely soon.

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top