MongoDB Plugin
  1. MongoDB Plugin
  2. GPMONGODB-178

Can't run app due to java.lang.IllegalAccessError

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0.0.RC4
    • Fix Version/s: 1.0.0.GA
    • Labels:
      None
    • Environment:
      grails 1.3.7
      java 6
      mac os x
      spring security plugin 1.2.1

      Description

      We tried to upgrade from RC3 to RC4 today and we can't build our app due to the errors below. We tried deleting the plugin manually, the ivy cache, etc. Not sure what else to try.

      Configuring Spring Security ...
      2012-02-17 17:46:21,875 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      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 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
      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)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTransactionManager': Cannot resolve reference to bean 'mongoDatastore' while setting bean property 'datastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      ... 23 more
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      ... 23 more
      Caused by: java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      at org.grails.datastore.mapping.mongo.MongoDatastore.createMongoTemplate(MongoDatastore.java:224)
      at org.grails.datastore.mapping.mongo.MongoDatastore.afterPropertiesSet(MongoDatastore.java:190)
      at org.grails.datastore.gorm.mongo.bean.factory.MongoDatastoreFactoryBean.getObject(MongoDatastoreFactoryBean.groovy:53)
      at org.grails.datastore.gorm.mongo.bean.factory.MongoDatastoreFactoryBean.getObject(MongoDatastoreFactoryBean.groovy)
      ... 23 more

      I installed the hibernate plugin in the test application and this is the error that I get:

      2012-02-21 13:24:33,554 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDatastore': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      at org.grails.datastore.gorm.plugin.support.PersistenceContextInterceptorAggregator.postProcessBeanFactory(PersistenceContextInterceptorAggregator.groovy:100)
      at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
      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)
      Caused by: java.lang.IllegalAccessError: tried to access method org.springframework.core.GenericTypeResolver.getTypeVariableMap(Ljava/lang/Class;)Ljava/util/Map; from class org.springframework.data.util.ClassTypeInformation
      at org.grails.datastore.mapping.mongo.MongoDatastore.createMongoTemplate(MongoDatastore.java:224)
      at org.grails.datastore.mapping.mongo.MongoDatastore.afterPropertiesSet(MongoDatastore.java:190)
      at org.grails.datastore.gorm.mongo.bean.factory.MongoDatastoreFactoryBean.getObject(MongoDatastoreFactoryBean.groovy:53)
      at org.grails.datastore.gorm.mongo.bean.factory.MongoDatastoreFactoryBean.getObject(MongoDatastoreFactoryBean.groovy)
      ... 24 more

      1. BuildConfig.groovy
        6 kB
        Daniel Chan
      2. mongotest.tar.gz
        228 kB
        Dan Polites
      3. verbose.txt
        857 kB
        Dan Polites

        Activity

        Hide
        Dan Polites added a comment -

        [Loaded org.springframework.core.GenericTypeResolver from file:/Users/dpolites/.ivy2/cache/org.springframework/org.springframework.core/jars/org.springframework.core-3.0.5.RELEASE.jar]

        I also attached verbose.txt which includes the entire output.

        Show
        Dan Polites added a comment - [Loaded org.springframework.core.GenericTypeResolver from file:/Users/dpolites/.ivy2/cache/org.springframework/org.springframework.core/jars/org.springframework.core-3.0.5.RELEASE.jar] I also attached verbose.txt which includes the entire output.
        Hide
        Graeme Rocher added a comment -

        The root cause of this is that spring-data-mongodb needs Spring 3.0.7 whilst Grails 1.3.7 uses Spring 3.0.5. The solution at the moment is to exclude the Spring jars from your global dependencies and add dependencies on 3.0.7

        Show
        Graeme Rocher added a comment - The root cause of this is that spring-data-mongodb needs Spring 3.0.7 whilst Grails 1.3.7 uses Spring 3.0.5. The solution at the moment is to exclude the Spring jars from your global dependencies and add dependencies on 3.0.7
        Hide
        Dan Polites added a comment -

        Thanks, that is good to know. Our solution was to upgrade to Grails 2

        Show
        Dan Polites added a comment - Thanks, that is good to know. Our solution was to upgrade to Grails 2
        Hide
        Daniel Chan added a comment -

        For people not able to upgrade to Grails 2, I've attached the BuildConfig.groovy snippets to replace Spring 3.0.5 by 3.0.7.

        Show
        Daniel Chan added a comment - For people not able to upgrade to Grails 2, I've attached the BuildConfig.groovy snippets to replace Spring 3.0.5 by 3.0.7.
        Hide
        Graeme Rocher added a comment -

        closing, since a workaround exists for 1.3.7 users and there isn't really much we can do about fixing this

        Show
        Graeme Rocher added a comment - closing, since a workaround exists for 1.3.7 users and there isn't really much we can do about fixing this

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Dan Polites
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: