Details
Description
Getting a RuntimeException when running test-app. This was reported in http://jira.codehaus.org/browse/GRAILS-5501 but not fixed in my case.
The issue is the same - ApplicationHolder.application is null once in the functional test phase. It works correctly when running "grails test-app -functional" but not when running "grails test-app"
I noticed the fix made for grails-5501 was in a conditional block which may prevent it executing if the integration phase has already
example quartz job:
<code>
import org.codehaus.groovy.grails.commons.ApplicationHolder
class TestJob {
def startDelay = (ApplicationHolder.application.config.jobs.test.time * 1000)
def execute() {
println "Run Job OK"
}
}
</code>
exception generated:
<code>
java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.plugins.quartz.DefaultGrailsTaskClass
at _PluginDependencies_groovy$_run_closure8_closure69.doCall(_PluginDepe
ndencies_groovy:619)
at _PluginDependencies_groovy$_run_closure8_closure69.doCall(_PluginDepe
ndencies_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:2
87)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _PluginDependencies_groovy$_run_closure8.doCall(_PluginDependencies_g
roovy:599)
at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:157)
at _GrailsTest_groovy$_run_closure11.doCall(_GrailsTest_groovy:329)
at _GrailsTest_groovy$_run_closure11.doCall(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:
178)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:168)
at TestApp$_run_closure1.doCall(TestApp:102)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Caused by: java.lang.reflect.InvocationTargetException
... 22 more
Caused by: org.codehaus.groovy.grails.exceptions.NewInstanceCreationException: C
ould not create a new instance of class [TestJob]!
... 22 more
Caused by: java.lang.NullPointerException
at TestJob.<init>(TestJob.groovy:5)
... 22 more
Error loading plugin manager: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.plugins.quartz.DefaultGrailsTaskClass
Application context shutting down...
Application context shutdown.
C:\Users\Paul\Documents\NetBeansProjects\broken-functional-phase\broken-function
</code>
Issue Links
| This issue is related to: | ||||
| GRAILS-5830 | test-app is broken after upgrade to garils-1.2.1 |
|
|
|
1.3.0: http://github.com/grails/grails/commit/178a1f4833d95c384ea826469d5603be13e8a255
1.2.x: http://github.com/grails/grails/commit/69d6774c5aa49ea5f4ac86af399b140333190370