Redis GORM Plugin
  1. Redis GORM Plugin
  2. GPREDIS-14

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

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Patch Submitted:
      Yes

      Description

      Copied from https://github.com/SpringSource/grails-data-mapping/issues/9, since we just found out that this is the correct location to log bugs. I can also confirm the defect Ted has reported.

      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.

        Activity

        John Fletcher created issue -
        Hide
        cdeszaq added a comment -

        This issue still occurs with grails v2.0.1, redis-gorm v1.0.0.M8, effectively removing the ability to use Redis as a GORM datastore completely.

        Steps to reproduce (with a Redis instance running):

        1. grails create-app test
        2. grails install-plugin redis-gorm

        • Note: grails run-app still works at this point
          3. append the config info from the manual to the end of the Config.grovy file
          grails.redis.host="myserver"
          grails.redis.port=6380
          grails.redis.password="secret"
          grails.redis.pooled=true
          grails.redis.resources=15
          grails.redis.timeout=5000

        4. grails run-app

        Generates this error message:

        Running Grails application

        Error 2012-02-27 20:05:22,093 [pool-7-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: 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
        Message: 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
        Line
        Method
        ->> 334
        innerRun in java.util.concurrent.FutureTask$Sync
        • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        166 run in java.util.concurrent.FutureTask
        1110 runWorker in java.util.concurrent.ThreadPoolExecutor
        603 run in java.util.concurrent.ThreadPoolExecutor$Worker
        ^ 679
        run . . . in java.lang.Thread

        Caused by 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
        ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync

        • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          166 run in java.util.concurrent.FutureTask
          1110 runWorker in java.util.concurrent.ThreadPoolExecutor
          603 run in java.util.concurrent.ThreadPoolExecutor$Worker
          ^ 679
          run . . . in java.lang.Thread

        Caused by 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
        ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync

        • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          166 run in java.util.concurrent.FutureTask
          1110 runWorker in java.util.concurrent.ThreadPoolExecutor
          603 run in java.util.concurrent.ThreadPoolExecutor$Worker
          ^ 679
          run . . . in java.lang.Thread

        Caused by 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
        ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync

        • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          166 run in java.util.concurrent.FutureTask
          1110 runWorker in java.util.concurrent.ThreadPoolExecutor
          603 run in java.util.concurrent.ThreadPoolExecutor$Worker
          ^ 679
          run . . . in java.lang.Thread
        Show
        cdeszaq added a comment - This issue still occurs with grails v2.0.1, redis-gorm v1.0.0.M8, effectively removing the ability to use Redis as a GORM datastore completely. Steps to reproduce (with a Redis instance running): 1. grails create-app test 2. grails install-plugin redis-gorm Note: grails run-app still works at this point 3. append the config info from the manual to the end of the Config.grovy file grails.redis.host="myserver" grails.redis.port=6380 grails.redis.password="secret" grails.redis.pooled=true grails.redis.resources=15 grails.redis.timeout=5000 4. grails run-app Generates this error message: Running Grails application Error 2012-02-27 20:05:22,093 [pool-7-thread-1] ERROR context.GrailsContextLoader - Error executing bootstraps: 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 Message: 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 Line Method ->> 334 innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166 run in java.util.concurrent.FutureTask 1110 runWorker in java.util.concurrent.ThreadPoolExecutor 603 run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 679 run . . . in java.lang.Thread Caused by 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 ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166 run in java.util.concurrent.FutureTask 1110 runWorker in java.util.concurrent.ThreadPoolExecutor 603 run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 679 run . . . in java.lang.Thread Caused by 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 ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166 run in java.util.concurrent.FutureTask 1110 runWorker in java.util.concurrent.ThreadPoolExecutor 603 run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 679 run . . . in java.lang.Thread Caused by 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 ->> 334 | innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 166 run in java.util.concurrent.FutureTask 1110 runWorker in java.util.concurrent.ThreadPoolExecutor 603 run in java.util.concurrent.ThreadPoolExecutor$Worker ^ 679 run . . . in java.lang.Thread
        Hide
        Ted Naleid added a comment - - edited

        I submitted a pull request (https://github.com/SpringSource/grails-data-mapping/pull/27) to "fix" this issue by removing the dependency on the base redis plugin and doing the suggested refactor as above so that the config namespace is "redis-gorm" instead of redis, removing the conflict.

        After this pull request is accepted and a new redis-gorm is pushed out, I can refactor the redis plugin to play nice with redis-gorm and potentially use it's datasource if it's available.

        Show
        Ted Naleid added a comment - - edited I submitted a pull request ( https://github.com/SpringSource/grails-data-mapping/pull/27 ) to "fix" this issue by removing the dependency on the base redis plugin and doing the suggested refactor as above so that the config namespace is "redis-gorm" instead of redis, removing the conflict. After this pull request is accepted and a new redis-gorm is pushed out, I can refactor the redis plugin to play nice with redis-gorm and potentially use it's datasource if it's available.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            John Fletcher
          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: