Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails NPE on all requests to controller until recompile without change to code
    text
    copied!<p>I'm using Grails 2.0.0. I've started using the webflow plug-in a couple days ago and today ran into some trouble. When I run the application and hit the controller that uses webflow, I get a NullPointerException. If I reload, I get the same. If I add a space to the controller source file (or any change at all, just need to force a recompile) and save with run-app still going, Grails recompiles the controller and subsequent requests work without error. Unfortunately I don't know when the error first came up. I haven't been able to trace the error back to a particular change I made. </p> <p>How can I dig deeper on this? Why would re-compiling a controller at run time fix an NPE? </p> <p>Here's the controller code that I can use to reproduce the issue:</p> <pre><code>class ServicesController { def index() { redirect(action: "request") } def requestFlow = { selectAssessments { on("next") { }.to("productInfo") on("cancel").to("finish") } } } </code></pre> <p>And here's the console log: </p> <pre><code>| Error 2012-03-18 21:43:11,272 ["http-bio-8080"-exec-4] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /project/services/request Stacktrace follows: Message: null Line | Method -&gt;&gt; 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | run in '' ^ 680 | run . . in java.lang.Thread | Error 2012-03-18 21:43:13,261 ["http-bio-8080"-exec-4] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception Message: No value for key [org.hibernate.impl.SessionFactoryImpl@57c40e95] bound to thread ["http-bio-8080"-exec-4] Line | Method -&gt;&gt; 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | run in '' ^ 680 | run . . in java.lang.Thread | Error 2012-03-18 21:43:14,199 ["http-bio-8080"-exec-5] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /project/services/request - parameters: execution: e1s1 Stacktrace follows: Message: null Line | Method -&gt;&gt; 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | run in '' ^ 680 | run . . in java.lang.Thread | Error 2012-03-18 21:43:14,262 ["http-bio-8080"-exec-5] ERROR servlet.GrailsDispatcherServlet - HandlerInterceptor.afterCompletion threw exception Message: No value for key [org.hibernate.impl.SessionFactoryImpl@57c40e95] bound to thread ["http-bio-8080"-exec-5] Line | Method -&gt;&gt; 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | run in '' ^ 680 | run . . in java.lang.Thread </code></pre> <p>From target/stacktrace.log:</p> <pre><code>2012-03-23 22:00:33,470 ["http-bio-8080"-exec-3] ERROR StackTrace - Full Stack Trace: java.lang.NullPointerException at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.postHandle(GrailsOpenSessionInViewInterceptor.java:75) at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.postHandle(WebRequestHandlerInterceptorAdapter.java:61) at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:342) ... 2012-03-23 22:00:33,490 ["http-bio-8080"-exec-3] ERROR StackTrace - Full Stack Trace: java.lang.NullPointerException 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:680) ... 2012-03-23 22:00:36,725 ["http-bio-8080"-exec-3] ERROR StackTrace - Full Stack Trace: java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@12653c7e] bound to thread ["http-bio-8080"-exec-3] at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:209) at org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor.afterCompletion(OpenSessionInViewInterceptor.java:211) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload