【问题标题】:grails-events-push plugin problems with Grails 2.3.3Grails 2.3.3 的 grails-events-push 插件问题
【发布时间】:2014-01-15 08:07:59
【问题描述】:

我在 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 运行此版本的插件有关的一些问题吗?

【问题讨论】:

    标签: grails grails-plugin


    【解决方案1】:

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

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

    plugin.platformCore.events.catchFlushExceptions = true
    

    【讨论】:

    • 谢谢!!,解决了 Spring Security 中的一个类似问题。
    猜你喜欢
    • 1970-01-01
    • 2014-08-30
    • 2016-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多