Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 如何解决grails引导执行错误;postProcessBeanDefinitionRegistry已为此后处理器“调用”了吗;?_Spring_Tomcat_Grails_Grails Plugin - Fatal编程技术网

Spring 如何解决grails引导执行错误;postProcessBeanDefinitionRegistry已为此后处理器“调用”了吗;?

Spring 如何解决grails引导执行错误;postProcessBeanDefinitionRegistry已为此后处理器“调用”了吗;?,spring,tomcat,grails,grails-plugin,Spring,Tomcat,Grails,Grails Plugin,我正在构建一个Grails(1.3.4)应用程序,配置了Grails插件tomcat-1.3.4,并使用Spring(3.0.3RELEASE),但重用了现有的Spring applicationContext.xml文件。我将旧文件的相关部分复制到Grails生成的文件中(就在characterencodingfilterbean下面)。在确保所有必需的JAR都在类路径上,并且bean名称没有冲突(我发现如果dataSource.groovy文件存在,那么dataSource已经被使用了,所以

我正在构建一个Grails(1.3.4)应用程序,配置了Grails插件tomcat-1.3.4,并使用Spring(3.0.3RELEASE),但重用了现有的Spring applicationContext.xml文件。我将旧文件的相关部分复制到Grails生成的文件中(就在characterencodingfilterbean下面)。在确保所有必需的JAR都在类路径上,并且bean名称没有冲突(我发现如果dataSource.groovy文件存在,那么dataSource已经被使用了,所以我删除了它以解决这个问题)之后,我面临一个非法的StateException。stacktrace和引导它的调试日志如下所示:

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)
更新: 如果我在applicationContext.xml顶部注释掉以下几行,它将进入一个无限循环

<context:annotation-config/>
<context:property-placeholder location="WEB-INF/config.properties"/>

如果我也注释掉我的导入行,它将按预期运行。导入行为:

<import resource="conf/membershipData.xml"/>
<import resource="conf/membershipServices.xml"/>

/更新

通过调试器追踪,我注意到它发生在启动期间的applicationContext刷新期间(DefaultRuntimeSpringConfiguration:154)

如果相关的话,我将使用IntelliJ IDEA 9,它将在运行app命令之前处理所有jar插入


谢谢您的帮助。

您不应该触摸applicationContext.xml-这是用于“父”应用程序上下文的。将bean复制到grails app/conf/spring下的resources.xml中。默认情况下不再创建此文件,因为首选方法是在resources.groovy中使用Spring bean DSL,但resources.xml的格式只是标准的Spring bean xml,因此您可能只需将xml文件复制到那里并将其重命名为resources.xml。

这里有问题吗?问题通常以问号(?)结尾。我的理解是,问题应该放在标题中(占位符文本显示“what's your programming question?bee specific”),如果你看那里,你会发现正确的标点符号存在。很高兴知道我不应该触摸父上下文文件。现在,我正在将声明向下移动到resources.xml文件的适当位置。一旦我让它从它所在的位置读取config.properties文件(它会看到属性文件,但不再用它们的值替换xml文件中的键,并且不会从config.groovy中获取任何键),我将返回并验证您的答案。谢谢你,伯特!