This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes using jdom to read xmlfile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "using jdom to read xmlfile" Watch "using jdom to read xmlfile" New topic

using jdom to read xmlfile

Daksha Tulshikar

Joined: Jun 21, 2001
Posts: 2
I have used Jdom to read an xml file by creating SaxBuilder instance and building the document using the buid command.
On the console it is working fine.
But as a servlet it is giving me errors.
It gives the following error
Error: 500
Internal Servlet Error:
java.lang.NoSuchMethodError: org.xml.sax.Attributes: method getQName(I)Ljava/lang/String; not found
at org.jdom.input.SAXHandler.startElement(
at org.apache.xerces.parsers.SAXParser.startElement(
at org.apache.xerces.framework.XMLParser.callStartElement(
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(
at org.apache.xerces.framework.XMLParser.parse(
at Item.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.tomcat.core.ServiceInvocationHandler.method(
at org.apache.tomcat.core.ServletWrapper.handleInvocation(
at org.apache.tomcat.core.ServletWrapper.handleRequest(
at org.apache.tomcat.core.InvokerServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.tomcat.core.ServiceInvocationHandler.method(
at org.apache.tomcat.core.ServletWrapper.handleInvocation(
at org.apache.tomcat.core.ServletWrapper.handleRequest(
at org.apache.tomcat.core.Context.handleRequest(
at org.enhydra.servlet.servletManager.ServletManager.service(
at org.enhydra.servlet.connectionMethods.http.HttpHandler.doARequest(
at org.enhydra.servlet.connectionMethods.http.HttpHandler.processRequests(
Can anyone tell the solution to solve this problem.

[This message has been edited by Daksha Tulshikar (edited June 21, 2001).]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

is your CLASSPATH (order in which the jars appear) same on the
command line and in the app server when it is running.
it is possible that the first class it finds may not have the
required method and so the Exception.
i would personally check this first.
- satya

Take a Minute, Donate an Hour, Change a Life

Joined: Nov 09, 2001
Posts: 6
Daksha Tulshikar,
I have faced the same problems with the saxon xsl stylesheet processor, could U give me some tips that how did U solve it?
shaonan zhang

Joined: Dec 12, 2002
Posts: 9
.I also have the same question.I want somebody who has experience of xml'programme on servlet has a good talk for us.
Think for all!
[ January 16, 2003: Message edited by: shaonan zhang ]

study hard, day day up!
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all,
JDOM requires a parser that supports DOM Level 2 and SAX 2.0.
Your error is due to a version of parser that does not support SAX 2.0.
You will have to do the following:
1. download a more recent version of your parser that support SAX 2.0 and DOM Level 2.
2. Add this parser to the classpath of your web server (and possibly remove the old parser archive)
(1) For instance, Xerces Java Parser 1.4.4 would fits your needs. Also JDOM comes bundled with a version of Xerces that has been fully tested to work with all JDOM APIs.
The following document found on the JDOM web site gives more details:
JDOM Frequently Asked Questions
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Well, if you are using tomcat3, then you also need get rid of some jar files came with tomcat. However, I'll strongly suggest you upgrade to tomcat4.1.18. That would solve many of your problems, since tomcat4 seperates the tomcat classpath with your application classpath. They don't interfere each other any more.
I agree. Here's the link:
subject: using jdom to read xmlfile
Similar Threads
Exception with the available Buffer
error executing j2ee example application
error in opening tld
Help needed urgently in running a servlet in J2sdkee1.2.1
validation using comparison operator in jsp