2011-02-25 58 views
7

我的jboss在嘗試運行我的應用程序(spring mvc)時拋出了不明確的錯誤。它部署好,而這個例外並沒有告訴我任何有用的東西,所以我不知道該怎麼做。我無法調試,不能做任何事情真的:JBoss中的「javax.servlet.ServletException:非HTTP請求或響應」

 
    13:00:01,262 INFO [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 2m:13s:790ms 

**Started successfully** 

在運行,從這種情況發生在瀏覽器應用程序:

13:00:09,456 ERROR [[appServlet]] Servlet.service() for servlet appServlet threw exception 
javax.servlet.ServletException: non-HTTP request or response 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:818) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190) 
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) 
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) 
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598) 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
    at java.lang.Thread.run(Thread.java:619) 

回答

11

它被作爲HttpServlet.service(ServletRequest, ServletResponse)時拋出的參數不能施法分別爲HttpServletRequestHttpServletResponse

這意味着兩種情況之一:

  • 的參數是錯誤的類型(不太可能)或
  • 某些濾波器是用這些類型的錯誤的拷貝,裝載有錯誤的類加載器(例如如果您將自己的servlet-api-x.x.jar副本與您的webapp一起發送)。
+1

如果您碰巧使用'ServletRequestWrapper'而不是'HttpServletRequestWrapper',參數可能是錯誤的類型 – kuporific 2015-10-01 11:20:54

+0

謝謝@kuporific改爲HttpServletRequestWrapper爲我解決了這個問題。 – Amber 2015-10-08 15:31:03

4

嘗試從WAR文件中刪除servlet-api jar。

1

如果您使用的是Maven,則可以將servlet-api的範圍設置爲provided