Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

using jdom to read xmlfile

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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(SAXBuilder.java:727)
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1256)
at org.apache.xerces.framework.XMLParser.callStartElement(XMLParser.java:1920)
at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1831)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1223)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1208)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:395)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:445)
at Item.doPost(Item.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:772)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:641)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:549)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:392)
at org.apache.tomcat.core.InvokerServlet.service(InvokerServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:641)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:549)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:392)
at org.apache.tomcat.core.Context.handleRequest(Context.java:732)
at org.enhydra.servlet.servletManager.ServletManager.service(ServletManager.java:1092)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.doARequest(HttpHandler.java:238)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.processRequests(HttpHandler.java:255)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.run(HttpHandler.java:93)
at java.lang.Thread.run(Thread.java:498)
Can anyone tell the solution to solve this problem.


[This message has been edited by Daksha Tulshikar (edited June 21, 2001).]
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
regds.
- satya
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Daksha Tulshikar,
Hi,
I have faced the same problems with the saxon xsl stylesheet processor, could U give me some tips that how did U solve it?
Thanks.
Roy
Huangrh@web.de
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
.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 ]
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Cheers
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Space pants. Tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic