I'm building a Grails (1.3.4) app configured with the grails plugin tomcat-1.3.4 and using Spring (3.0.3RELEASE) but reusing an existing Spring applicationContext.xml file. I copied the relevant portions of the old file into the one generated by Grails (just below the characterEncodingFilter bean). After making sure that all the required jars were on the classpath, and that there was no conflict in bean names (I found out that dataSource was already used if the DataSource.groovy file exists, so I deleted it to resolve that), I am faced with an IllegalStateException. The stacktrace and a bit of the debug log leading it is as follows:
2010-09-30 15:29:36,131 [main] DEBUG xml.DefaultDocumentLoader - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
2010-09-30 15:29:36,143 [main] DEBUG support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'grailsApplication'
2010-09-30 15:29:36,149 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: postProcessBeanDefinitionRegistry already called for this post-processor
java.lang.IllegalStateException: postProcessBeanDefinitionRegistry already called for this post-processor
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Update: If I comment out the following lines at the top of my applicationContext.xml, it goes into an infinite loop.
<context:annotation-config/>
<context:property-placeholder location="WEB-INF/config.properties"/>
If I also comment out my import lines, it runs as expected. The import lines are:
<import resource="conf/membershipData.xml"/>
<import resource="conf/membershipServices.xml"/>
/Update
Tracing down through the debugger, I noticed that it occurs during a refresh of the applicationContext during start up (DefaultRuntimeSpringConfiguration:154).
In case it is relevant, I'm using IntelliJ IDEA 9, which is handling all of the jar insertions before the run-app command.
Thanks for your help.