[jdom-interest] Error in building SAX2 driver

Satyan Nair satyan at cobite.com
Thu Jul 26 15:48:31 PDT 2001


Hello,
I got this error in the very first example that I executed using JDOM. When
I used DOM my JSP/XML example worked perfectly.
this is the code structure and below that is the error generated also.
I m running JBOSS with TOMCAT server.
I have the jdom and xerces jar files in my application lib directory.

WEB-INF
----lib
--------jdom.jar
--------xerces.jar

this is the example from chapter 12 - JSP and XML (page 421) from
Professional JSP 2nd edition (WROX)
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------
<%@ page language="java" import="java.io.*, org.jdom.*,
org.jdom.input.SAXBuilder" %>
<%! File docfile = new
File("/usr/local/JBoss-2.2.1_Tomcat-3.2.1/tomcat/webapps/satyan_cobite/messa
ge.xml" ); %>

<html>
<head>
<title>First xml java test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<%

	SAXBuilder builder = new
SAXBuilder("org.apache.xerces.parsers.SAXParser" );
	Document l_doc = builder.build(docfile);

%>

This is a test page.....

the value in xml file is : <%=
l_doc.getRootElement().getChild("message").getText() %>

</body>
</html>
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------

ERROR
org.jdom.JDOMException: Error in building: SAX2 driver class
org.apache.xerces.parsers.SAXParser not found
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:411)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:445)
	at
_0002fdom_0005fmessage_00031_0002ejspdom_0005fmessage1_jsp_25._jspService(_0
002fdom_0005fmessage_00031_0002ejspdom_0005fmessage1_jsp_25.java:71)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)
Root cause: java.lang.ClassNotFoundException:
org.apache.xerces.parsers.SAXParser
	at
org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:1
18)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:263)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:445)
	at
_0002fdom_0005fmessage_00031_0002ejspdom_0005fmessage1_jsp_25._jspService(_0
002fdom_0005fmessage_00031_0002ejspdom_0005fmessage1_jsp_25.java:71)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
	at org.apache.tomcat.core.Handler.service(Handler.java:286)
	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
	at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
	at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
	at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
	at java.lang.Thread.run(Thread.java:484)




More information about the jdom-interest mailing list