Results: controlling XML documents by JSP 

Voters
1 You may not vote on this poll

  • HTML code is OFF
    0%
  • vB code is ON
    100.00%
  • Smilies are ON
    0%
  • [IMG] code is OFF
    0%
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Japan
    Posts
    2
    Rep Power
    0

    Unhappy controlling XML documents by JSP


    Hi all,

    I am struggling with creating databese system using XML, JSP, MySQL technology.

    I have been getting an error message like below.
    Whenever I try to run JSP code which contorolls XML data, I get this error. I think that some important things that I don't know yet is missing. like Driver, parser or another things.

    Since the error msg says something about "org.apache.jasper.JasperException", I was trying to figure out what "jaspser" means.
    However, with my poor java skill, I couldn't figure it out.....

    Could anybody teach me what my problem is??

    I installed,
    j2sdk-1_4_1_01
    apache_2.0.45
    tomcat-4.1.24
    mysql-4.0.12
    JCBC for MySQL
    Xerces.2.4.0

    Thank you in advance.
    Jun



    This is what I wrote as JSP code:
    ------------------------------------------------------------------

    <%@ page contentType="text/html; charset=Shift_JIS"
    import="java.sql.*,java.io.*,org.apache.xerces.parsers.*,org.xml.sax.*,org.w3c.dom.*" %>
    <%
    DOMParser prs = new DOMParser();
    FileReader fl = new FileReader(application.getRealPath("/transit.xml"));
    BufferedReader br = new BufferedReader(fl);
    InputSource src = new InputSource(br);
    prs.parse(src);
    Document objDoc = prs.getDocument();
    Element objRoot = objDoc.getDocumentElement();
    NodeList clnNod = objRoot.getChildNodes();

    for(int i=0; i<clnNod.getLength();i++)
    {
    Element objNod=(Element)clnNod.item(i);
    Attr atrNam=(Attr)objNod.getAttributes().item(0);
    if(request.getParameter("name").equals(atrNam.getValue()))
    {
    Element obj1=(Element)objNod.getElementsByTagName("from_url").item(0);
    %>
    <dl>
    <dt style="font=size:14pt;font-weight:bold;">
    F<%=atrNam.getValue() %>
    <hr />
    </dt>
    <dd>
    <table border="0">
    <tr>
    <th>
    <td><%=obj1.getChildNodes().item(0).getNodeValue() %>
    </td>
    </tr>
    </table>
    </dd>
    </dl>
    <%
    }
    }
    br.close();
    %>
    ------------------------------------------------------------------



    This is what I get as error messages:
    ------------------------------------------------------------------
    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.jav a:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)


    root cause

    java.lang.ClassCastException
    at org.apache.jsp.xmlSrch_jsp._jspService(xmlSrch_jsp.java:59)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.j ava:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.jav a:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    Why did you post a poll? Delete and repost please!

    Check the:

    root cause

    java.lang.ClassCastException
    at org.apache.jsp.xmlSrch_jsp._jspService(xmlSrch_jsp.java:59)
    .....
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Japan
    Posts
    2
    Rep Power
    0

    Unhappy Re: controlling XML documents by JSP


    Thank you for reply, pabloj.

    I did post a poll by accident.. sorry about that.

    Back to the subject, Could you please tell me more detail about what you said?

    I checked java.lang.ClassCastException at class API doc., which said "Signals that an invalid cast has occurred. ".

    In my JSP code, "Element objNod=(Element)clnNod.item(i); " was the code which is mentioned in error msg,"xmlSrch_jsp.java:59".

    I couldn't figure out what's wrong with this code...

    Thanks,

    Jun

IMN logo majestic logo threadwatch logo seochat tools logo