wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Request is null when Request Wrapper is used in filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Request is null when Request Wrapper is used in filter" Watch "Request is null when Request Wrapper is used in filter" New topic
Author

Request is null when Request Wrapper is used in filter

Ruhul Mazumder
Greenhorn

Joined: Sep 26, 2006
Posts: 5
Hi ALL,

Our application has multipart form and normal form. We are using servlet filter for doing authentication and authorization. For multipart for we are creating request multipart wrapper to do multiple read of multipart data. Everything works fine but sometimes we get null pointer exception while setting attribute in servlets (whenrequest is a multipart wrapper ).

In wrapper we are getting the input stream and storing it in byte array and overring getReader() and getInputStream() to use the byte array

Below is the stack trace,

Jan 13, 2012 10:05:27 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [XXXServlet] in context with path [/XXXX] threw exception
java.lang.NullPointerException
at org.apache.catalina.connector.Request.setAttribute(Request.java:1563)
at org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:543)
at javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:239)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:285)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.xxx.filter.webfilter.XXXNFilter.doFilter(XXXNFilter.java:78)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Please let me know if anyone has face same error and how to solve this issue.

Thanks in Advanced,
Ruhul
 
Don't get me started about those stupid light bulbs.
 
subject: Request is null when Request Wrapper is used in filter
 
Similar Threads
datatable selection returning null
JASPER export to pdf using Servlet Detail not show..help please
JSF Exception
Cannot create a session after the response has been committed
Tomcat + JNDI + Oracle Database restart - No more data to read from socket