2014-02-25 66 views
0

我使用jsp調用搜索算法來搜索Solr並獲取結果。基於Tomcat的solr搜索,NoHttpResponseException,所有添加的jar添加

我的jsp頁面是這樣的:

<table class="table table-hover"> 
     <tr> 
      <td>Your Search Results:</td> 
      <td> 
       <% 
        String queryKey = request.getParameter("jobSearch"); 
        ArrayList<String> resultSet = SearchSolr.queryAll(queryKey); 
        out.println(resultSet); 
       %> 
      </td> 
     </tr> 
</table> 

頁繼續給我的錯誤就行:

ArrayList<String> resultSet = SearchSolr.queryAll(queryKey); 

表示:

java.lang.ClassNotFoundException: org.apache.http.NoHttpResponseException 

例外外觀像這樣:

type Exception report 

message An exception occurred processing JSP page /Result.jsp at line 40 

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

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /Result.jsp at line 40 

37:     <td> 
38:      <% 
39:       String queryKey = request.getParameter("jobSearch"); 
40:       ArrayList<String> resultSet = SearchSolr.queryAll(queryKey); 
41:       out.println(resultSet); 
42:      %> 
43:     </td> 


Stacktrace: 
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
root cause 

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException 
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912) 
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841) 
    org.apache.jsp.Result_jsp._jspService(Result_jsp.java:129) 
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
root cause 

java.lang.NoClassDefFoundError: org/apache/http/NoHttpResponseException 
    com.demoApp.solrJ.SearchSolr.queryAll(SearchSolr.java:16) 
    org.apache.jsp.Result_jsp._jspService(Result_jsp.java:103) 
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
root cause 

java.lang.ClassNotFoundException: org.apache.http.NoHttpResponseException 
    java.net.URLClassLoader$1.run(URLClassLoader.java:366) 
    java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
    java.security.AccessController.doPrivileged(Native Method) 
    java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
    java.lang.ClassLoader.loadClass(ClassLoader.java:423) 
    java.lang.ClassLoader.loadClass(ClassLoader.java:356) 
    com.demoApp.solrJ.SearchSolr.queryAll(SearchSolr.java:16) 
    org.apache.jsp.Result_jsp._jspService(Result_jsp.java:103) 
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) 
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 

我已經導入了所有必要的罐子,包括HttpClient的,的HttpCore,httpmime,HttpClient的緩存等

我進口的罐子如下:http://imageshack.com/a/img401/329/3we1.jpg

+0

你可以轉儲你的classpath jar嗎? –

+0

@AlexanderJardim你的意思是刪除它們全部並再次添加? – GeorgeG

+0

不,請將您加載的classpath轉儲到pastebin.com之類的內容中,以便我們可以一起分析它。 –

回答

0

它必須導入項目中所有罐子到Tomcat的lib文件夾。解決了!