gcj/376: Problem with DOM/SAX XML Parsers
agis@nortelnetworks.com
agis@nortelnetworks.com
Thu Nov 30 04:40:00 GMT 2000
>Number: 376
>Category: gcj
>Synopsis: Problem with DOM/SAX XML Parsers
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 30 04:40:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: agis@nortelnetworks.com
>Release: unknown-1.0
>Organization:
>Environment:
RedHat Linux, HPUX
>Description:
Dear Sir
Due to an ongoing project, some members of my team use the GCJ compiler to produce executable files from JAVA code. There is, however one case where we are getting some unexplainable errors and I thouhg of asking someone expert. So, here is tha situation:
I have the following JAVA file (SAXSpeed.java) , which uses the IBM Java XML Parser to parse an XML file and time this parsing:
===========================================================================================
import java.io.PrintStream;
import org.apache.xerces.framework.XMLParser;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.SAXParseException;
import org.xml.sax.SAXException;
import org.xml.sax.*;
public class SAXSpeed
{
private long elements;
private long attributes;
private long characters;
public static void main(String args[])
{
if(args.length == 0)
System.exit(1);
for(int i = 0; i < args.length; i++)
{
String s = args[i];
print(s);
}
}
public static void print(String s)
{
try
{
SAXParser saxparser = new SAXParser();
long before = System.currentTimeMillis();
saxparser.parse(s);
long after = System.currentTimeMillis();
System.out.print(s);
System.out.print(": ");
System.out.print(after - before);
System.out.print(" ms");
}
catch(SAXParseException saxparseexception)
{
saxparseexception.printStackTrace(System.err);
}
catch(SAXException saxexception)
{
if(saxexception.getException() != null)
saxexception.getException().printStackTrace(System.err);
else
saxexception.printStackTrace(System.err);
}
catch(Exception exception)
{
exception.printStackTrace(System.err);
}
}
}
===========================================================================
This file compiles normally with JDK 1.2.2 and also with the -target 1.1 option, which simulates it with the 1.1 version of JAVA. The generated class file is attached in the email. In order to work, the attached zip library (xerces.zip) as well as the path of the class file need to be included in the classpath.
The class file runs normally when I use java command and it times the xml parsing succesfully.
The problems start when I start using the gcj compiler. I use the following command line (in LINUX OS):
gcj --main=SAXSpeed --classpath=/root/parsers/xml/xerces.zip:/urs/local/gcj/shares/libgcj.zip:. -o SAXSpeed SAXSpeed.class
or
gcj --main=SAXSpeed --classpath=/root/parsers/xml/xerces.zip:/urs/local/gcj/shares/libgcj.zip:. -o SAXSpeed SAXSpeed.java
No matter how many combinations I tried in the command line, I keep receiving the following error messages:
========================================================================================
/tmp/ccIDEHfu.o: In function `SAXSpeed::print(java::lang::String *)':
/root/parsers/jars/SAXSpeed.class(.text+0xe9): undefined reference to `_CL_Q53org6apache6xerces7parsers9SAXParser'
/root/parsers/jars/SAXSpeed.class(.text+0x11b): undefined reference to `org::apache::xerces::parsers::SAXParser::SAXParser(void)'
/tmp/ccIDEHfu.o: In function `SAXSpeed::SAXSpeed(void)':
/root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x14): undefined reference to `_CL_Q43org3xml3sax17SAXParseException'
/root/parsers/jars/SAXSpeed.class(.gcc_except_table+0x24): undefined reference to `_CL_Q43org3xml3sax12SAXException'
collect2: ld returned 1 exit status
========================================================================================
It doesn't seem to find the class files, although they do exist in the zip file and in the right directory structure. How is that possible?
I know that what I ask is something that will probably take time but I would be greatful if you could help me out with this.
Thank you very much in advance
Agis
Agisilaos Kalogiannis
Software Engineer
Wireless & Carrier Netwoks
Nortel Networks
Tel: +44 (0)1279 403407
Mob: +44 (0)772 0844109
agis@nortelnetworks.com
agis_k@hotmail.com
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list