问题
I just upgraded one of my grails 2.3.8 projects to grails 2.4.0. Just for your information: This project ist very complex and depends on many plugins, so it has many dependencies.
Until now i think everything works but i can't start my grails app with "run-app" because of this exception:
| Error 2014-06-02 18:13:00,560 [localhost-startStop-1] ERROR plugins.DefaultGrailsPluginManager - Error configuring dynamic methods for plugin [taxonomy:1.2]: Method on class [com.grailsrocks.taxonomy.Taxonomy] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
Message: Method on class [com.grailsrocks.taxonomy.Taxonomy] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
Line | Method
->> -1 | currentGormStaticApi in com.grailsrocks.taxonomy.Taxonomy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1270 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 1371 | invokeStaticMissingMethod in groovy.lang.MetaClassImpl
| 1359 | invokeStaticMethod . . . . . . in ''
| 1123 | invokeStaticMethod in groovy.lang.ExpandoMetaClass
| 50 | call . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.StaticMetaClassSite
| 45 | defaultCall in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 116 | call in ''
| 14 | init . . . . . . . . . . . . . in com.grailsrocks.taxonomy.TaxonomyService
| -1 | invoke in com.grailsrocks.taxonomy.TaxonomyService$$FastClassBySpringCGLIB$$f377ff8e
| 204 | invoke . . . . . . . . . . . . in org.springframework.cglib.proxy.MethodProxy
| 708 | invokeJoinpoint in org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation
| 157 | proceed . . . . . . . . . . . in org.springframework.aop.framework.ReflectiveMethodInvocation
| 98 | proceedWithInvocation in org.springframework.transaction.interceptor.TransactionInterceptor$1
| 262 | invokeWithinTransaction . . . in org.springframework.transaction.interceptor.TransactionAspectSupport
| 95 | invoke in org.springframework.transaction.interceptor.TransactionInterceptor
| 179 | proceed . . . . . . . . . . . in org.springframework.aop.framework.ReflectiveMethodInvocation
| 644 | intercept in org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor
| -1 | init . . . . . . . . . . . . . in com.grailsrocks.taxonomy.TaxonomyService$$EnhancerBySpringCGLIB$$ddb414ec
| 45 | defaultCall in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 112 | call in ''
| 43 | doCall . . . . . . . . . . . . in TaxonomyGrailsPlugin$_closure3
| -2 | invoke0 in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke . . . . . . . . . . . . in ''
| 43 | invoke in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke . . . . . . . . . . . . in java.lang.reflect.Method
| 1270 | jlrMethodInvoke in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke . . . . . . . . . . . . in org.codehaus.groovy.reflection.CachedMethod
| 233 | doMethodInvoke in groovy.lang.MetaMethod
| 1085 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 1110 | invokeMethod in groovy.lang.ExpandoMetaClass
| 909 | invokeMethod . . . . . . . . . in groovy.lang.MetaClassImpl
| 423 | call in groovy.lang.Closure
| -1 | call . . . . . . . . . . . . . in TaxonomyGrailsPlugin$_closure3
| 702 | doWithDynamicMethods in org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin
| 783 | doDynamicMethods . . . . . . . in org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager
| 172 | configure in org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator
| 127 | configure . . . . . . . . . . in ''
| 126 | configureWebApplicationContext in org.codehaus.groovy.grails.web.context.GrailsConfigUtils
| 109 | initWebApplicationContext . . in org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
| 106 | contextInitialized in org.springframework.web.context.ContextLoaderListener
| 4973 | listenerStart . . . . . . . . in org.apache.catalina.core.StandardContext
| 5467 | startInternal in ''
| 150 | start . . . . . . . . . . . . in org.apache.catalina.util.LifecycleBase
| 1559 | call in org.apache.catalina.core.ContainerBase$StartChild
| 1549 | call . . . . . . . . . . . . . in ''
| 262 | run in java.util.concurrent.FutureTask
| 1145 | runWorker . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 744 | run . . . . . . . . . . . . . in java.lang.Thread
I'm using some of the dynamic methods of the taxonomy plugin in my BootStrap.groovy at application startup. I can't figure out why it doesn't work because i didn't change code so far. Maybe someone knows a solution?
回答1:
Downgrading the hibernate plugin to ':hibernate:3.6.10.14' helped. Seems that the taxonomy plugin isn't compatible with the new hibernate4 plugin.
来源:https://stackoverflow.com/questions/23999078/method-was-used-outside-of-a-grails-application-after-upgrade-to-grails-2-4-0