Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

custom redis-gorm plugin config has conflict with base redis config #9

Closed
tednaleid opened this issue Nov 1, 2011 · 5 comments
Closed

Comments

@tednaleid
Copy link
Contributor

The redis-gorm plugin was modified to rely on the redis plugin for much of it's work. They still use separate datasources though, and the redis-gorm plugin needs to be refactored to have it's plugin config renamed so that it matches the plugin name.

Currently, with the released redis-gorm plugin code, if you make an application and install the redis-gorm plugin. Then if you create a test that exercises redis:

package com.example

import grails.test.*

class RedisIntegrationTests extends GroovyTestCase {

    def redisService

    void testSomething() {
        redisService.foo = "bar"
        assert "bar" == redisService.foo
    }
}

You'll see that it blows up if you try to use a config like this:

grails.redis.host="locahost"
grails.redis.port=6379
grails.redis.pooled=true
grails.redis.resources=15
grails.redis.timeout=5000

You'll get a stacktrace like this:

Error executing script TestApp: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
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)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
at _GrailsBootstrap_groovy$_run_closure2_closure14.doCall(_GrailsBootstrap_groovy:102)
at _GrailsBootstrap_groovy$_run_closure2_closure14.doCall(_GrailsBootstrap_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:94)
at _GrailsBootstrap_groovy$_run_closure6.doCall(_GrailsBootstrap_groovy:152)
at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy:314)
at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:184)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:174)
at TestApp$_run_closure1.doCall(TestApp.groovy:82)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
... 10 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
--- Nested Exception ---
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
at _GrailsBootstrap_groovy$_run_closure2_closure14.doCall(_GrailsBootstrap_groovy:102)
at _GrailsBootstrap_groovy$_run_closure2_closure14.doCall(_GrailsBootstrap_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsBootstrap_groovy$_run_closure2.doCall(_GrailsBootstrap_groovy:94)
at _GrailsBootstrap_groovy$_run_closure6.doCall(_GrailsBootstrap_groovy:152)
at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy:314)
at _GrailsTest_groovy$_run_closure9.doCall(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure1_closure21.doCall(_GrailsTest_groovy:184)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:174)
at TestApp$_run_closure1.doCall(TestApp.groovy:82)
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)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found
... 22 more
Error executing script TestApp: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTransactionManager': Cannot resolve reference to bean 'redisDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisDatastore': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'groovy.util.ConfigObject' to required type 'java.util.Map' for property 'config'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [groovy.util.ConfigObject] to required type [java.lang.String] for property 'config[poolConfig]': no matching editors or conversion strategy found

I think that there might be a bigger bug with the way the redis-gorm plugin is pulling in

At the very least, the RedisSpringConfigurer should probably be refactored to it's own configuration space with something like this:

diff --git a/grails-datastore-gorm-redis/src/main/groovy/org/grails/datastore/gorm/redi
index 9d79edd..64160f6 100644
--- a/grails-datastore-gorm-redis/src/main/groovy/org/grails/datastore/gorm/redis/plugi
+++ b/grails-datastore-gorm-redis/src/main/groovy/org/grails/datastore/gorm/redis/plugi
@@ -29,7 +29,7 @@ class RedisSpringConfigurer extends SpringConfigurer{
     @Override
     Closure getSpringCustomizer() {
         return {
-            def redisConfig = application.config?.grails?.redis
+            def redisConfig = application.config?.grails?.redis-gorm

             redisDatastoreMappingContext(RedisMappingContextFactoryBean) {
                 grailsApplication = ref('grailsApplication')

(thanks to Christian Oestreich for the bug report and details)

Longer term, the redis-gorm plugin should be refactored to rely on the same datasource as the redis plugin has.

@fletchgqc
Copy link

Confirm - I'm experiencing the same issue.

@fletchgqc
Copy link

Copied to project issue tracker at http://jira.grails.org/browse/GPREDIS-14

@cazacugmihai
Copy link

I've also have this issue. Is there any progress with this bug? Thanks.

@fletchgqc
Copy link

Cazacugmihai - please watch and vote on it at http://jira.grails.org/browse/GPREDIS-14 as we've been informed that this is where issues are tracked for this project, not on github.

@jetztgradnet
Copy link

I also have this problem. Is there a workaround without patching either of the plugins?

beckje01 referenced this issue in beckje01/grails-data-mapping Feb 16, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

5 participants