grails-events-push Grails 2.3.3的插件问题

时间:2014-01-14 23:08:04

标签: grails grails-plugin

我在BuildConfig.groovy中有以下配置:

plugins {
    ...
    compile ':events-push:1.0.M7'
}

通过该更改可以正常更新项目。但是,当我启动应用程序时,我会得到:

 Running Grails application
| Error 2014-01-14 23:59:33,800 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'grailsEventsPublisher': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'boolean' for property 'catchFlushExceptions'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [groovy.util.ConfigObject] to required type [boolean] for property 'catchFlushExceptions': PropertyEditor [org.springframework.beans.propertyeditors.CustomBooleanEditor] returned inappropriate value of type [groovy.util.ConfigObject]
Message: Error creating bean with name 'grailsEventsPublisher': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'boolean' for property 'catchFlushExceptions'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [groovy.util.ConfigObject] to required type [boolean] for property 'catchFlushExceptions': PropertyEditor [org.springframework.beans.propertyeditors.CustomBooleanEditor] returned inappropriate value of type [groovy.util.ConfigObject]
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by TypeMismatchException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'boolean' for property 'catchFlushExceptions'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [groovy.util.ConfigObject] to required type [boolean] for property 'catchFlushExceptions': PropertyEditor [org.springframework.beans.propertyeditors.CustomBooleanEditor] returned inappropriate value of type [groovy.util.ConfigObject]
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by IllegalArgumentException: Cannot convert value of type [groovy.util.ConfigObject] to required type [boolean] for property 'catchFlushExceptions': PropertyEditor [org.springframework.beans.propertyeditors.CustomBooleanEditor] returned inappropriate value of type [groovy.util.ConfigObject]
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread
Disconnected from the target VM, address: '127.0.0.1:51065', transport: 'socket'

这是否与使用Grails 2.3.3运行此版本的插件有关?

1 个答案:

答案 0 :(得分:4)

这看起来像是一个事件插件依赖的平台核心插件中的错误。如果未在Config.groovy中设置值(通常在使用ConfigSlurperConfigObject时),则第一次属性值将为新的空ConfigObject访问。如果处理不当,这会导致奇怪的错误,例如因为它是Map并且它是空的,toString()值是[:]。空映射是Groovy-false,因此使用if测试通常会起作用,但这里假设设置了一个布尔值。

根据doWithConfigOptions块中的设置,catchFlushExceptions的默认值似乎为true,因此将其添加到您应用的Config.groovy将会解决此问题:

plugin.platformCore.events.catchFlushExceptions = true