当地环境:
- Grails v2.4.2
- Java v1.8.0_66
- 雄猫 v7.0.53
- 视窗 10
服务器环境:
- Grails v2.4.2
- Java v1.8.0_66
- Glassfish v4.1.1
- Ubuntu v14.4.01
问题描述:
我最近将我的 grails 应用程序从一个非常旧的 Debian Linux 服务器迁移到了一个 Docker 容器。这一切都完美无缺。我使用 Java 1.8.0_66 构建了应用程序并将其部署到 Glassfish 容器,并将其与 MySQL 容器链接。我使用的 Docker 镜像glassfish/server
来自 Docker hub。此图像使用 Glassfish 4.1.1 和 Java 1.8.0_66。
但是,在本地,我不能使用run-app
or test-app
。这是堆栈跟踪:
Mär 04, 2016 2:04:41 PM org.springsource.loaded.jvm.JVM copyMethod
SCHWERWIEGEND: Problems copying method. Incompatible JVM?
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor72.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.jvm.JVM.copyMethod(JVM.java:134)
at org.springsource.loaded.ri.JavaMethodInvoker.createJavaMethod(JavaMethodInvoker.java:48)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetMethods(ReflectiveInterceptor.java:168)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at java.beans.Introspector.__sljlcgms(Introspector.java)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1336)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197)
at java.beans.Introspector.getBeanInfo(Introspector.java:426)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at groovy.lang.MetaClassImpl$15.run(MetaClassImpl.java:3065)
at java.security.AccessController.doPrivileged(Native Method)
at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3063)
at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3046)
at groovy.lang.ExpandoMetaClass.initialize(ExpandoMetaClass.java:483)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:210)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:241)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:255)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:859)
at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
at groovy.lang.Closure.<init>(Closure.java:219)
at Config$_run_closure4.<init>(Config.groovy)
at Config.run(Config.groovy:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at org.codehaus.groovy.reflection.CachedMethod$invoke.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.reflection.CachedMethod$invoke.call(Unknown Source)
at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:266)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:80)
at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1108)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:39)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:284)
at groovy.util.ConfigSlurper$parse.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at groovy.util.ConfigSlurper$parse.callCurrent(Unknown Source)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:158)
at groovy.util.ConfigSlurper$parse$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:148)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager.createConfig(GrailsProjectPackager.groovy:345)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager.packageApplication(GrailsProjectPackager.groovy:274)
at org.codehaus.groovy.grails.project.packaging.GrailsProjectPackager$packageApplication.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.runInstance(ForkedGrailsTestRunner.groovy:127)
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProjectClassExecutor.run(ForkedGrailsProjectClassExecutor.groovy:74)
at org.codehaus.groovy.grails.cli.fork.testing.ForkedGrailsTestRunner.main(ForkedGrailsTestRunner.groovy:75)
Caused by: java.lang.IllegalArgumentException: Can not copy a non-root Method
at java.lang.reflect.Method.copy(Method.java:151)
... 69 more
在本地使用 Glassfish 和相同的 VM 可以正常工作。我认为这是一个Tomcat问题。这个问题帮助我弄清楚 Java > 1.8.0_31 不适用于 Grails。然而,令我惊讶的是它在 Glassfish 上没有任何问题,更令我惊讶的是它不适用于 Tomcat,尤其是因为 Grails 主要与 Tomcat 一起使用。
是否有任何解决方法可以在本地使用带有 Java > 1.8.0_31的run-app
and命令进行开发?test-app
或者,如果没有,在没有集成 Tomcat 环境的情况下运行所有或特定 Spock-Unit-Tests 的任何其他便捷方式?