[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-dev] Class path issue for Java extensions with Sun JDK 1.5
|
Sorry that I am not sure whether I am posting to the right place...
I found a class path issue for Java extenstions with JDK1.5.0. The extended library we used in this case is apache xalan 2.7.0, which can be downloaded from http://apache.osuosl.org/xml/xalan-j/binaries/xalan-j_2_7_0-bin.zip.
Attached is a snippet to reproduce this issue, comparing with JDK1.4.2. While running XalanApplication as Java Application, both JVMs work. While running XalanApplication as Eclipse Application, only 1.4.2 works! The 1.5.0 throws an NoClassDefFoundError.
(See attached file: jvmtest.zip)
Eclipse Version: 3.2.1
Build id: M20060921-0945
Please note that xalan jar files are installed into <jre>/lib/ext directory in both 1.4.2 and 1.5.0, and apache claimed that this version of xalan is compatible with Sun JVM 1.3.x, 1.4.x, or 5.x . (see http://xml.apache.org/xalan-j/downloads.html).
I would appreciate it very much if anyone could help us find the root cause!
Frank,
R&D Engineer, IBM China Research Lab
---------- XalanApplication ----------
package com.ibm.crl.jvmtest;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.xpath.XPathAPI;
import org.eclipse.core.runtime.IPlatformRunnable;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
public class XalanApplication implements IPlatformRunnable {
String pidf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
+ " <presence entity=\"sip:fantongx@9.45.89.88\" > "
+ " <ep:person xmlns:ep=\"urn:ietf:params:xml:ns:pidf:person\"> "
+ " <status> "
+ " <basic>open</basic> "
+ " </status> "
+ " </ep:person> "
+ " </presence>";
public Object run(Object args) throws Exception {
FileInputStream fis = null;
try {
StringReader reader = new StringReader(pidf);
InputSource in = new InputSource(reader);
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
factory.setNamespaceAware(false);
Document doc = factory.newDocumentBuilder().parse(in);
Node node = XPathAPI.selectSingleNode(doc, "/presence");
System.out.println(node.getAttributes().getNamedItem("entity")
.getNodeValue());
} catch (Throwable e) {
e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
}
}
}
return EXIT_OK;
}
public static void main(String[] args) {
try {
new XalanApplication().run(null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- Error thrown by 1.5.0 ----------
java.lang.NoClassDefFoundError: org/apache/xpath/XPathAPI
at com.ibm.crl.jvmtest.XalanApplication.run(XalanApplication.java:35)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
---------- Sun JDK 1.5.0_11 ----------
---------- Sun JDK 1.4.2_05 ----------
Attachment:
jvmtest.zip
Description: Zip archive