" HTTP状态500 - org.apache.catalina.session.StandardSessionFacade无法强制转换为javax.servlet.ServletRequest"与doPost方法相关的错误

时间:2016-04-15 02:22:01

标签: java jsp servlets model-view-controller controllers

我有一个search.jsp页面,我想在ControllerServlet.java类中路由到一个doPost方法,但我一直收到错误说#34; HTTP Status 500 - org.apache.catalina.session.StandardSessionFacade无法转换为javax.servlet.ServletRequest。

错误:

gdb-peda$ context_code
[-------------------------------------code-------------------------------------]
   0xb7fdf1c3:  ret    
   0xb7fdf1c4:  lea    esi,[esi+0x0]
   0xb7fdf1ca:  lea    edi,[edi+0x0]
=> 0xb7fdf1d0 <_start>: mov    eax,esp
   0xb7fdf1d2 <_start+2>:   call   0xb7fe2c80 <_dl_start>
   0xb7fdf1d7 <_dl_start_user>: mov    edi,eax
   0xb7fdf1d9 <_dl_start_user+2>:   call   0xb7fdf1c0
   0xb7fdf1de <_dl_start_user+7>:   add    ebx,0x1fe16
gdb-peda$ bt
#0  0xb7fdf1d0 in _start () from /lib/ld-linux.so.2
gdb-peda$ i r esp
esp            0xbffff3e0   0xbffff3e0

任何人都知道出了什么问题?

这是search.jsp文件的表单代码:

HTTP Status 500 - org.apache.catalina.session.StandardSessionFacade cannot be cast to javax.servlet.ServletRequest

type Exception report

message org.apache.catalina.session.StandardSessionFacade cannot be cast to javax.servlet.ServletRequest

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

exception

java.lang.ClassCastException: org.apache.catalina.session.StandardSessionFacade cannot be cast to javax.servlet.ServletRequest
    edu.unsw.comp9321.ControllerServlet.doPost(ControllerServlet.java:95)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.

这是我想将搜索结果路由到doPost方法的ControllerServlet:

<!-- HTML for SEARCH BAR -->
<div id="header">
<center>
    <form id="new-search" method="post" action="search">
        <!-- hidden input tag to identify this form action as search -->
        <input type="hidden" name="action" value="search"></input>

        <input type="text" name="content" class="searchtextinput" size="80" maxlength="100" placeholder="Search Artist, Title, Albums or Songs..."></input>
        <input type="submit" value="search" class="searchbutton"></input>

        <div>&nbsp;</div>
        <div>Advanced Search:
        <select name="options">
            <option value="anything">Anything</option>
            <option value="album">Album</option>
            <option value="artist">Artist</option>
            <option value="songs">Songs</option>
        </select>
        </div>

    </form>
</center>
<div class="searchclear"></div>

0 个答案:

没有答案