Bug #2835
closedData Manager Library: Run-time errors involving Xalan classes
0%
Description
Two developers (myself and Chad Burt) are getting run-time errors when our applications try to use the Data Manager library. The errors are NoClassDefFoundError involving Xalan classes.
On 4/30/2007, Chad Burt wrote:
Hi guys,
I am trying to deploy my sbc app with the datamanager library on a different machine and am having some problems. It seems to be missing a dependancy that is not on this fedora linux machine. I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xpath/axes/PredicatedNodeTest
I never ran into this problem on my mac, i just built the jar and it worked fine. Originally I thought it was because the jar needed to be recompiled because I was on a different machine. So I copied the whole eml tree over, hit "ant clean", then "ant dist-datamanager-lib", and uncompressed the zip to get my jar. No error messages. Ran my dataset import method based off the sample applications and I got the same error.
Is there some kind of apache library I need to have on this machine to get the datamanager library working?
Here is the full stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError : org/apache/xpath/axes/PredicatedNodeTest
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run( URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java :306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.apache.xpath.XPath.<init>(XPath.java:199)
at org.apache.xpath.CachedXPathAPI.eval(CachedXPathAPI.java:322)
at org.apache.xpath.CachedXPathAPI.selectNodeIterator(CachedXPathAPI.java :216)
at org.apache.xpath.CachedXPathAPI.selectSingleNode(CachedXPathAPI.java:177)
at org.apache.xpath.CachedXPathAPI.selectSingleNode(CachedXPathAPI.java:157)
at org.ecoinformatics.datamanager.parser.eml.Eml200Parser.parseDocument (Eml200Parser.java:182)
at org.ecoinformatics.datamanager.parser.eml.Eml200Parser.parse(Eml200Parser.java:160)
at org.ecoinformatics.datamanager.DataManager.parseMetadata(DataManager.java:585)
at org.ecoinformatics.datamanager.sample.ImportDataset.testParseMetadata(ImportDataset.java:331)
at org.ecoinformatics.datamanager.sample.ImportDataset.main(ImportDataset.java:132)
-Chad Burt
On 4/30/2007, Duane Costa wrote:
Hi Chad,
I recently started experiencing a very similar run-time error on my Windows machine in an application I am developing that uses the datamanager library too. The only difference is that in my case the NoClassDefFoundError was for a different class:
org.apache.xpath.patterns.NodeTest
After a little trial and error, I found that I could resolve the error by incorporating a newer version of xalan.jar, based on Xalan-Java Version 2.7.0, into my classpath. I am attaching the xalan.jar file that fixed the problem for me. It seems that the NodeTest class was missing from the older xalan.jar but present in the newer xalan.jar. I'm guessing that the same might be true for the PredicatedNodeTest class.
I don't really understand was caused the error to start occurring; it may have something to do with the Java version I am running (I upgraded from Java 1.4.2 to Java 1.5.0 fairly recently). Jing and I will need to investigate this further. Meanwhile, as a temporary fix, could you try including the new xalan.jar file in your sbc application's classpath and let us know if that resolves the error for you?
Thanks,
Duane
On 4/30/2007, Chad Burt wrote:
Thanks Duane,
I'm not too familiar with java and classpaths. I'm calling the datamanager.jar from the command line. I replaced eml/lib/apache/xalan.jar with the one you gave me. Is that correct? I'm getting the same error.
-Chad
On 4/30/2007, Duane Costa wrote:
Hi Chad,
Interesting, I did exactly what you did, replaced eml/lib/apache/xalan.jar with the one I sent you, and rebuilt datamanager.jar using 'ant jar-datamanager-lib'. Now I'm getting the same error you've been getting! So the new xalan.jar obviously is not the solution, but at least we're getting the same error now. This is going to take more investigation. I'll try to get this figured out. Meanwhile, could you please send me the following?:
(1) The output from running 'java -version' in a command window on your system.
(2) The output from running 'echo $CLASSPATH' in a command window on your system.
(3) The exact command you use when you run the Data Manager library code.
Thanks,
Duane
On 4/30/2007, Char Burt wrote:
Here's my info:
java -version:
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
$CLASSPATH doesn't seem to be set, nor $CLASS_PATH. It's not set on my mac either.
I am running a custom method based on the sample apps. I've attached the file. It's usually under /src/org/ecoinformatics/datamanager/sample/ImportDataset.java.
I call it via :
java -cp "datamanager.jar" org.ecoinformatics.datamanager.sample.ImportDataset > /dev/null
Thanks for the help,
Chad
Updated by Duane Costa over 17 years ago
The bug was in build.xml. It has been resolved with the following update:
costa 07/05/18 07:20:13
Modified: . build.xml
Log:
Bug fix for bug #2835. The 'excludes' directive:
<jar jarfile="${build.dir}/${datamanager.name}.jar"
basedir="${build.dest}"
excludes="**/**Test.class"
/>
was causing Xalan classes NodeTest.class and PredicatedNodeTest.class to be excluded from the datamanager jar file. Modified this to:
<jar jarfile="${build.dir}/${datamanager.name}.jar"
basedir="${build.dest}"
excludes="org/ecoinformatics/datamanager/**/**Test.class"
/>
so that only test classes specific to the datamanager packages are excluded from the jar file.
Revision Changes Path
1.95 +3 -3 eml/build.xml
Index: build.xml
===================================================================
RCS file: /cvs/eml/build.xml,v
retrieving revision 1.94
retrieving revision 1.95
diff u -r1.94 -r1.95
-- build.xml 7 Dec 2006 19:10:13 -0000 1.94
+++ build.xml 18 May 2007 14:20:13 -0000 1.95
@ -15,8 +15,8
@
For Details: http://knb.ecoinformatics.org/
'$Author: costa $'
- '$Date: 2006/12/07 19:10:13 $'
- '$Revision: 1.94 $'
+ '$Date: 2007/05/18 14:20:13 $'
+ '$Revision: 1.95 $'
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -560,7 +560,7
@
todir="${build.dest}"/>
<jar jarfile="${build.dir}/${datamanager.name}.jar"
basedir="${build.dest}"
- excludes="**/**Test.class"
+ excludes="org/ecoinformatics/datamanager/**/**Test.class"
/>
</target>