Author: fbysss
MSN: jameslastchina@hotmail.com
Blog: blog.csdn.net/fbysss
Disclaimer: This article is original from fbysss. for reprinting, please indicate the source
Keyword: Tomcat filter exception
Background: The implementation project is running under tomcat5.02, and everything is normal. The development environment uses tomcat5.5. There are no other problems, but the file upload error is reported:
Javax. servlet. servletexception: servlet execution threw an exception
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 260)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 157)
At com. FG. Common. util. encodefilter. dofilter (encodefilter. Java: 35)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 186)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 157)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 214)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardcontextvalve. invokeinternal (standardcontextvalve. Java: 198)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 152)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 137)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 118)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 102)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. containerbase. Invoke (containerbase. Java: 929)
At org. Apache. Coyote. tomcat5.coyoteadapter. Service (coyoteadapter. Java: 160)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 799)
At org. Apache. Coyote. http11.http11protocol $ http11connectionhandler. processconnection (http11protocol. Java: 705)
At org.apache.tomcat.util.net. tcpworkerthread. Runit (pooltcpendpoint. Java: 577)
At org. Apache. tomcat. util. threads. threadpool $ controlrunnable. Run (threadpool. Java: 683)
At java. Lang. thread. Run (thread. Java: 595)
------ Character Set Conversion error --------
Javax. servlet. servletexception: servlet execution threw an exception
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 260)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 157)
At com. FG. Common. util. encodefilter. dofilter (encodefilter. Java: 35)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 186)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 157)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 214)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardcontextvalve. invokeinternal (standardcontextvalve. Java: 198)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 152)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 137)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 118)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 102)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. Core. standardvalvecontext. invokenext (standardvalvecontext. Java: 104)
At org. Apache. Catalina. Core. standardpipeline. Invoke (standardpipeline. Java: 520)
At org. Apache. Catalina. Core. containerbase. Invoke (containerbase. Java: 929)
At org. Apache. Coyote. tomcat5.coyoteadapter. Service (coyoteadapter. Java: 160)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 799)
At org. Apache. Coyote. http11.http11protocol $ http11connectionhandler. processconnection (http11protocol. Java: 705)
At org.apache.tomcat.util.net. tcpworkerthread. Runit (pooltcpendpoint. Java: 577)
At org. Apache. tomcat. util. threads. threadpool $ controlrunnable. Run (threadpool. Java: 683)
At java. Lang. thread. Run (thread. Java: 595)
Troubleshooting:
1. Comments out all the code in dofilter are still incorrect and cannot be debugged. It is very annoying.
2. comment out the filter segment in Web. xml and run it again. Finally, the following information is displayed:
Java. Lang. noclassdeffounderror: ORG/Apache/commons/fileupload/fileuploadexception
Java. Lang. Class. getdeclaredconstructors0 (native method)
Java. Lang. Class. privategetdeclaredconstructors (unknown source)
Java. Lang. Class. getconstructor0 (unknown source)
Java. Lang. Class. newinstance0 (unknown source)
Java. Lang. Class. newinstance (unknown source)
Org. Apache. Struts. util. requestutils. applicationinstance (requestutils. Java: 145)
Org. Apache. Struts. util. requestutils. getmultiparthandler (requestutils. Java: 577)
Org. Apache. Struts. util. requestutils. populate (requestutils. Java: 450)
Org. Apache. Struts. Action. requestprocessor. processpopulate (requestprocessor. Java: 798)
Org. Apache. Struts. Action. requestprocessor. Process (requestprocessor. Java: 205)
Org. Apache. Struts. Action. actionservlet. Process (actionservlet. Java: 1158)
Org. Apache. Struts. Action. actionservlet. dopost (actionservlet. Java: 415)
Javax. servlet. http. httpservlet. Service (httpservlet. Java: 709)
Javax. servlet. http. httpservlet. Service (httpservlet. Java: 802)
The original is less commons-fileupload.jar!
Summary:Such a simple problem is confusing at first. It seems that the exception is blocked by the filter. As for how to shield it, it is necessary to analyze the Tomcat source code later. There are always some gains: in the future, there will be an inexplicable error in the filter. First, remove the filter and debug it.