[jdom-interest] Tomcat3.2 and jdom

koka phani phani_koka at yahoo.com
Sat Oct 20 04:32:18 PDT 2001


Hi all,

       I am using tomcat 3.2 and jdom-b7.

 I am calling bean from jsp file.The bean is working standalone but i am getting errors when i try to call that using jsp.

Erros:

Internal Servlet Error:


javax.servlet.ServletException: org/jdom/input/DOMBuilder	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:508)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)	at org.apache.tomcat.core.Handler.service(Handler.java:287)	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)	at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)	at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)	at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)	at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)	at java.lang.Thread.run(Thread.java:484)

Root cause: 

java.lang.NoClassDefFoundError: org/jdom/input/DOMBuilder	at java.lang.Class.newInstance0(Native Method)	at java.lang.Class.newInstance(Class.java:237)	at java.beans.Beans.instantiate(Beans.java:207)	at java.beans.Beans.instantiate(Beans.java:51)	at jsp.d_00025mbean._0002fjsp_0002fdombean_0002fstockadd_0002ejspstockadd_jsp_7._jspService(_0002fjsp_0002fdombean_0002fstockadd_0002ejspstockadd_jsp_7.java:75)	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$JspCountedServlet.service(JspServlet.java:130)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)	at org.apache.tomcat.core.Handler.service(Handler.java:287)	at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)	at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)	at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)	at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)	at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)	at java.lang.Thread.run(Thread.java:484)

I place jdom.jar in tomcat/lib and update the tomcat.bat file

if exist "%TOMCAT_HOME%\lib\jdom.jar" set CP=%CP%;%TOMCAT_HOME%\lib\jdom.jar

Why i am getting errors. My jsp and bean are given below.

Plese help me  out from this .Thanks in advance.

I am passing stock,name,price values for another jsp file to add.jsp file.

add.jsp

<html>

<head>

<title>Serch Results</title>

<%@ page import="dombean.*" %>

</head>

<jsp:useBean id="addBean" class="dombean.addelements"/>

<body>

<%String symbol=request.getParameter("symbol");%>

<%String name=request.getParameter("name");%>

<%String price=request.getParameter("price");%>

<%addBean.adding(symbol,name,price);%>

<%=symbol%>

</body>

</html>

My addelements.java :

package dombean;

import java.io.FileInputStream;

import java.io.FileOutputStream;

import org.jdom.Document;

import org.jdom.Element;

import org.jdom.input.DOMBuilder;

import org.jdom.output.XMLOutputter;

public class addelements{

public void adding(String symbol,String name,String price)

{

String Symbol=symbol;

String Name=name;

String Price=price;

try

{

DOMBuilder builder=new DOMBuilder("org.jdom.adapters.XercesDOMAdapter");

Document doc=builder.build(new FileInputStream("c:/xml/stocks.xml"));

Element root=doc.getRootElement();

Element parent=new Element("stock");

Element child1=new Element("symbol").setText(symbol);

Element child2=new Element("name").setText(name);

Element child3=new Element("price").setText(price);

root.addContent(parent);

parent.addContent(child1);

parent.addContent(child2);

parent.addContent(child3);

XMLOutputter fmt=new XMLOutputter();

fmt.output(doc,new FileOutputStream("stocks.xml"));

}

catch(Exception e)

{

e.printStackTrace();

}

}

}

Thanks in advance

phani

 



---------------------------------
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20011020/6e27ba2c/attachment.htm


More information about the jdom-interest mailing list