I use the Grails Quartz and get the following error while running:
| Error 2013-11-25 16:38:34,701 [quartzScheduler_Worker-1] ERROR listeners.ExceptionPrinterJobListener - Exception occurred in job: Grails Job
Message: java.lang.NoClassDefFoundError: Could not initialize class grails.plugin.asyncmail.AsynchronousMailPersistenceService$_selectMessagesIdsForSend_closure1
Line | Method
->> 111 | execute in grails.plugins.quartz.GrailsJobFactory$GrailsJob
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 202 | run in org.quartz.core.JobRunShell
^ 573 | run . . in org.quartz.simpl.SimpleThreadPool$WorkerThread
Caused by NoClassDefFoundError: Could not initialize class grails.plugin.asyncmail.AsynchronousMailPersistenceService$_selectMessagesIdsForSend_closure1
->> 20 | selectMessagesIdsForSend in grails.plugin.asyncmail.AsynchronousMailPersistenceService
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 18 | findAndSendEmails in grails.plugin.asyncmail.AsynchronousMailProcessService
| 19 | execute in grails.plugin.asyncmail.AsynchronousMailJob
| 104 | execute in grails.plugins.quartz.GrailsJobFactory$GrailsJob
| 202 | run . . in org.quartz.core.JobRunShell
^ 573 | run in org.quartz.simpl.SimpleThreadPool$WorkerThread
How can I avoid this error?
Edit: Grails version 2.2.4
Related
I am partially done through the setup -
- setup grails 2.4.0 , jdk 1.7.0, gradle 5.4.1, but now I checked that this version of gradle is incompatible with jdk 7.
- copied the .grails folder contents from earlier working setup.
- took code into sew working directorty.
I am able to run grails and run-app, but when I browse to the application URL, I get a 500 error, with the following stacktrace -
Trace
Line | Method
->> 527 | doFilter in /Users/sandeepan.nath/Desktop/codebase/some-consumer-portal/grails-app/views/linkLogin/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: Cannot get property 'application' on null object
->> 11 | doCall in /Users/sandeepan.nath/Desktop/codebase/some-consumer-portal/grails-app/views/linkLogin/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: Cannot get property 'application' on null object
->> 37 | run in Users_sandeepan_nath_Desktop_codebase_some_consumer_portal_grails_app_views_include__head_gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 29 | doCall in Users_sandeepan_nath_Desktop_codebase_some_consumer_portal_grails_app_views_linkLogin_index_gsp$_run_closure1
| 36 | run . . . in Users_sandeepan_nath_Desktop_codebase_some_consumer_portal_grails_app_views_linkLogin_index_gsp
| 198 | doFilter in PageFragmentCachingFilter.java
| 63 | doFilter in AbstractFilter.java
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Inside my Applicant domain class I have the following:
static hasMany = [recommendationFiles:ApplicantFile]
static mapping = {recommendationFiles joinTable: [name:"LETTER_FILES", key: "APPLICANT_ID", column: "LETTER_ID"]}
When I do the following:
def applicant = Applicant.findByENumber(session.user.eNumber)
def applicantFiles = applicant.recommendationFiles
println applicantFiles
applicantFiles.each {
applicant.removeFromRecommendationFiles(it)
}
applicant.save(flush:true)
I get this as an error which makes no sense to me:
| Error 2015-04-08 10:41:59,570 [http-bio-8080-exec-10] ERROR errors.GrailsExceptionResolver - ConcurrentModificationException occurred when processi
ng request: [POST] /scholarshipsystem/specialized/index - parameters:
_action_reUpload: Re-Upload
Stacktrace follows:
Message: null
Line | Method
->> 793 | nextEntry in java.util.HashMap$HashIterator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 828 | next in java.util.HashMap$KeyIterator
| 106 | reUpload in scholarshipSystem.SpecializedController$$EP9HMKbd
| 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run . . . in ''
^ 662 | run in java.lang.Thread
There's a few ways to make this work. One way is to convert the list to an array and iterate over it.
def list = applicantFiles.toArray()
list.each {
applicant.removeFromRecommendationFiles(it)
}
Another way, if you're just removing the entire collection would be to...
applicant.recommendationFiles*.delete()
applicant.recommendationFiles.clear()
Starting out with Grails I have installed Grails version 2.4.0 and using JDK 1.7.0_55 on GNU/Linux I do the sequence of actions below but keep getting a NullPointerException. Can someone provide a pointer to what I am missing or doing wrong ?
grails create-app firstgrails
cd firstgrails
grails
grails> run-app
I go to localhost:8080/firstgrails and see the generated page.
Next I do
grails> create-domain-class tag
and go to the firstgrails/grails-app/domain/firstgrails folder and edit Tag.groovy so it contains:
// Tag.groovy
package firstgrails
class Tag {
String name
String description
}
Next
grails> create-controller tag
and edit firstgrails/grailsapp/controllers/firstgrails/TagController.groovy into
// TagController.groovy
package firstgrails
class TagController {
static scaffold = Tag
}
I do a reload in the browser and firstgrails.TagController is added to the list of available
controllers under the welcome message. Selecting it, I create a tag with name and description and the tag shows up in the list of tags as expected. But now whenever I try to add a second tag I get an 500 error: Internal Server Error with
URI: /firstgrails/tag/create
Class: java.lang.NullPointerException
Message: null
The trace in the console is:
Error 2014-06-03 18:28:31,714 [http-bio-8080-exec-2] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error 2014-06-03 18:30:33,050 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error 2014-06-03 18:32:21,796 [http-bio-8080-exec-5] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
I tried this and able to reproduce it. If we generate view then it is resolved but without views it is giving error. There is an issue in grails jira, see this issue they have provided a patch for it.
Hope this helps.
I'm new to Grails (predominantly a Java Developer), dipping my toe into Grails.
My initial experience is generally good, but I'm experiencing some problems with the scaffold feature...
I've installed STS (3.5.1.RELEASE) and have installed the Grails(2.4.0) and Groovy plugins.
I created a Domain Class (Rat) and a Controller class and added a scaffold to the Controller.
package testnull
class RatController {
static scaffold = Rat
def index() { }
}
I started up the app and the scaffold displays fine, but after a few cycles of creating editing and deleting it throws a NullPointerException:
Line | Method
->> 527 | doFilter in /rat/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /rat/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /rat/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 30 | doCall . in rat_create$_run_closure2_closure24
| 35 | doCall in rat_create$_run_closure2
| 37 | run . . . in rat_create
| 189 | doFilter in PageFragmentCachingFilter.java
| 63 | doFilter in AbstractFilter.java
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
If I 'generate-views' and remove the 'scaffold' it all works fine.
Is this a known issue?
Regards,
Chris
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.
How can I dig deeper on this? Why would re-compiling a controller at run time fix an NPE?
Here's the controller code that I can use to reproduce the issue:
class ServicesController {
def index() {
redirect(action: "request")
}
def requestFlow = {
selectAssessments {
on("next") {
}.to("productInfo")
on("cancel").to("finish")
}
}
}
And here's the console log:
| 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
->> 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
->> 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
->> 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
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 908 | run in ''
^ 680 | run . . in java.lang.Thread
From target/stacktrace.log:
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)
Seems to have been fixed by creating a new controller of a different name using grails create-controller, and copying the code over from the old controller to the new one. Was unable to find root cause of the exception. 'grails clean' did not fix it, by the way.