grails 2.2.2执行脚本RunApp时出错:class sun.reflect.GeneratedMethodAccessor44无法访问其超类sun.reflect.MethodAccessorImpl

时间:2015-01-20 12:24:41

标签: grails

我面临关于Grails 2.2.2的问题。 我的应用程序运行良好,但在我重新设置我的PC并重新安装软件之后,例如:JDK,GGTS ......当我运行命令时,我总是收到以下错误:

grails run-app

错误:

| Configuring classpath
Resolving [test] dependencies...
Resolving [runtime] dependencies...
| Error Error executing script RunApp: class sun.reflect.GeneratedMethodAccessor44 cannot access its superclass sun.reflect.MethodAccessorImpl
java.lang.IllegalAccessError: class sun.reflect.GeneratedMethodAccessor44 cannot access its superclass sun.reflect.MethodAccessorImpl
at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395)
    at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:46)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
    at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.addUrlsToRootLoader(ClasspathConfigurer.java:280)
    at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.configuredClassLoader(ClasspathConfigurer.java:74)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:624)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:408)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:373)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:232)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1243)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
| Error Error executing script RunApp: class sun.reflect.GeneratedMethodAccessor44 cannot access its superclass sun.reflect.MethodAccessorImpl

实际上,错误不仅出现在运行命令:grails run-app时,即使运行命令:grails --refresh-dependencies

以下是类似的错误:

 Error java.lang.reflect.InvocationTargetException
 Error         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 Error         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 Error         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 Error         at java.lang.reflect.Method.invoke(Method.java:601)
 Error         at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
 Error         at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
 Error         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 Error         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 Error         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 Error         at java.lang.reflect.Method.invoke(Method.java:601)
 Error         at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:234)
 Error         at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:262)
 Error Caused by: java.lang.IllegalAccessError: class sun.reflect.GeneratedMethodAccessor41 cannot access its superclass sun.reflect.MethodAccessorImpl
 Error         at sun.misc.Unsafe.defineClass(Native Method)
 Error         at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
 Error         at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
 Error         at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396)
 Error         at java.security.AccessController.doPrivileged(Native Method)
 Error         at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395)
 Error         at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:77)
 Error         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:46)
 Error         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 Error         at java.lang.reflect.Method.invoke(Method.java:601)
 Error         at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.addUrlsToRootLoader(ClasspathConfigurer.java:280)
 Error         at org.codehaus.groovy.grails.cli.support.ClasspathConfigurer.configuredClassLoader(ClasspathConfigurer.java:74)
 Error         at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:624)
 Error         at org.codehaus.groovy.grails.cli.GrailsScriptRunner.initializeState(GrailsScriptRunner.java:607)
 Error         at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:220)
 Error         ... 12 more

任何人都对这个问题有一些想法?

注意:我试过两个JDK版本:1.6.0_29和1.7.0_11,得到同样的错误。

1 个答案:

答案 0 :(得分:0)

根本原因是类路径的配置错误:我在类路径中配置了jre的rt.jar库。删除它,然后解决此问题。