Reputation: 1758
I have run into a very weird problem, and I have simply no idea, where to start. In our working application, one of our pages seems to fail kinda arbitrarily - that is, sometimes it works, and sometimes it doesn't.
The web application is running Java 6, Spring 2.5.6 and Hibernate 3.2.6. Furthermore, we are using Javax.servlet version 3.0 (might be relavant).
The problem becomes hard, because of a very limited stacktrace, which doesn't seem to involve any of our custom code (all our classes start with com.isworld.*).
The error occurs AFTER loading the page, when the form is submitted and the request is beeing processed. See stacktrace below:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.lang.NullPointerException
This is all there is to the stacktrace.
I do not expect any of you to come up with a solution to this problem, but hopefully, you can point me in some direction - I have no more ideas...
Upvotes: 6
Views: 9088
Reputation: 1734
I had a same symptom with @Hoof. But In my case It was in my development laptop. And after restarting tomcat root cause's Stacktrace is now being seen again.
Upvotes: 1
Reputation: 77191
Set a breakpoint in your IDE to 'stop on throw' of NullPointerException (attach remote debugger if necessary)
Upvotes: 2
Reputation: 5853
Spring Framework is open source, right? So lets have a look what is there at 583 line of FrameworkServlet
...
What we can find there is following:
try {
doService(request, response);
//omit a few catches...
} catch (Throwable ex) {
failureCause = ex;
throw new NestedServletException("Request processing failed", ex); //line 583
}
So the exception comes from FrameworkServlet.doService
method and it properly handled by Spring Framework. So lets have a look at the troublesome doService
method...
FrameworkServlet.doService
is abstract, but is implemented in DispatcherServlet
that you most likely use in your project. Further it calls 'doDispatch' that dispatches handling of the request to the controller.
And my gut feeling tels me that the nasty NPE
that we've been hunting here so persistently is hidden in your controller code...
Upvotes: 5
Reputation: 2370
So, a NullPointerException happens during the execution of the servlet, and this exception is caught by the Spring framework which doesn't seem to bother displaying it.
You need to know where this NullPointerException happens.
Here are two possible ways to investigate further:
Wrap your servlet with a try/catch to trap all exceptions, as in:
try { ... your servlet code ... } catch (RuntimeException e) { e.printStackTrace(); }
Upvotes: 0