我在 Grails 2.0.4 应用程序中得到以下堆栈跟踪:
java.lang.ArrayIndexOutOfBoundsException: 6170
at com.springsource.loaded.NameRegistry.getIdFor(NameRegistry.java:44)
at com.springsource.loaded.NameRegistry.getIdOrAllocateFor(NameRegistry.java:59)
at com.springsource.loaded.TypeRegistry.getTypeIdFor(TypeRegistry.java:756)
at com.springsource.loaded.MethodInvokerRewriter$RewriteClassAdaptor$RewritingMethodAdapter.rewritePUTSTATIC(MethodInvokerRewriter.java:789)
at com.springsource.loaded.MethodInvokerRewriter$RewriteClassAdaptor$RewritingMethodAdapter.visitFieldInsn(MethodInvokerRewriter.java:708)
at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:280)
at com.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:83)
at com.springsource.loaded.TypeRegistry.methodCallRewrite(TypeRegistry.java:767)
at com.springsource.loaded.agent.ModifyDefineInClassLoaderForClassArtifactsType.modify(ModifyDefineInClassLoaderForClassArtifactsType.java:77)
at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.define(ClassLoaderForClassArtifacts.java)
at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts$1.run(ClassLoaderForClassArtifacts.java:86)
at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts$1.run(ClassLoaderForClassArtifacts.java:84)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.ClassLoaderForClassArtifacts.defineClassAndGetConstructor(ClassLoaderForClassArtifacts.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.compilePogoMethod(CallSiteGenerator.java:217)
at org.codehaus.groovy.reflection.CachedMethod.createPogoMetaMethodSite(CachedMethod.java:228)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createCachedMethodSite(PogoMetaMethodSite.java:207)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.createPogoMetaMethodSite(PogoMetaMethodSite.java:183)
at groovy.lang.MetaClassImpl.createPogoCallCurrentSite(MetaClassImpl.java:3022)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallCurrentSite(CallSiteArray.java:95)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
< actual call site in my code, some method call to the same service the original method is in>
显然我的 google-Fu 已经失去了我,或者以前没有人遇到过这个问题。甚至搜索都不会com.springsource.loaded.NameRegistry
产生任何结果。
在多次尝试相同的操作后,问题通常会消失,但这很难解决。关于我可以寻找什么的任何提示?
我的疯狂猜测是 Spring 正在代理我试图调用的方法,并且不知何故无法在自己的注册表中查找它。这怎么可能是我的错?
编辑:导致此问题的 Stacktrace 中的第一行是一个无害的方法调用,例如以下foo
方法bar
中的调用:
class FooService {
def foo(bla, bloerk) {
1
}
def bar() {
foo(1,2)
}
}