<P>Hi all,</P>
<P> I am using tomcat 3.2 and jdom-b7.</P>
<P> 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.</P>
<P>Erros:</P>
<P><STRONG>Internal Servlet Error:<BR></STRONG></P><PRE>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)
</PRE>
<P><B>Root cause:</B> </P><PRE>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)
</PRE>
<P>I place jdom.jar in tomcat/lib and update the tomcat.bat file</P>
<P>if exist "%TOMCAT_HOME%\lib\jdom.jar" set CP=%CP%;%TOMCAT_HOME%\lib\jdom.jar</P>
<P>Why i am getting errors. My jsp and bean are given below.</P>
<P>Plese help me out from this .Thanks in advance.</P>
<P>I am passing stock,name,price values for another jsp file to add.jsp file.</P>
<P>add.jsp</P><FONT face="Courier New">
<P><html></P>
<P><head></P>
<P><title>Serch Results</title></P>
<P><%@ page import="dombean.*" %></P>
<P></head></P>
<P><jsp:useBean id="addBean" class="dombean.addelements"/></P>
<P><body></P>
<P><%String symbol=request.getParameter("symbol");%></P>
<P><%String name=request.getParameter("name");%></P>
<P><%String price=request.getParameter("price");%></P>
<P><%addBean.adding(symbol,name,price);%></P>
<P><%=symbol%></P>
<P></body></P>
<P></html></P>
<P>My addelements.java :</P><FONT face=Arial color=#000000>
<P>package dombean;</P>
<P>import java.io.FileInputStream;</P>
<P>import java.io.FileOutputStream;</P>
<P>import org.jdom.Document;</P>
<P>import org.jdom.Element;</P>
<P>import org.jdom.input.DOMBuilder;</P>
<P>import org.jdom.output.XMLOutputter;</P>
<P>public class addelements{</P>
<P>public void adding(String symbol,String name,String price)</P>
<P>{</P>
<P>String Symbol=symbol;</P>
<P>String Name=name;</P>
<P>String Price=price;</P>
<P>try</P>
<P>{</P>
<P>DOMBuilder builder=new DOMBuilder("org.jdom.adapters.XercesDOMAdapter");</P>
<P>Document doc=builder.build(new FileInputStream("c:/xml/stocks.xml"));</P>
<P>Element root=doc.getRootElement();</P>
<P>Element parent=new Element("stock");</P>
<P>Element child1=new Element("symbol").setText(symbol);</P>
<P>Element child2=new Element("name").setText(name);</P>
<P>Element child3=new Element("price").setText(price);</P>
<P>root.addContent(parent);</P>
<P>parent.addContent(child1);</P>
<P>parent.addContent(child2);</P>
<P>parent.addContent(child3);</P>
<P>XMLOutputter fmt=new XMLOutputter();</P>
<P>fmt.output(doc,new FileOutputStream("stocks.xml"));</P>
<P>}</P>
<P>catch(Exception e)</P>
<P>{</P>
<P>e.printStackTrace();</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>Thanks in advance</P>
<P>phani</P></FONT>
<P> </P></FONT><p><br><hr size=1><b>Do You Yahoo!?</b><br>
Make a great connection at <a
href="http://rd.yahoo.com/mktg/mail/txt/tagline/?http://personals.yahoo.com" target="_blank">Yahoo! Personals</a>.