19

有没有人幸运地使用 Java 7 运行 Grails 1.3.7 应用程序?我创建了一个全新的 Grails 1.3.7 应用程序并尝试在 Java 7 下运行它。我收到以下错误,但应用程序似乎运行正常。我们有一些 1.3.7 应用程序我们不愿意升级到 Grails 2.x,所以任何想法都将不胜感激。

Unable to use direct char[] access of java.lang.String
java.lang.NoSuchFieldException: count
    at java.lang.Class.getDeclaredField(Class.java:1899)
    at org.codehaus.groovy.grails.web.util.StringCharArrayAccessor.<clinit>(StringCharArrayAccessor.java:53)
    at org.codehaus.groovy.grails.web.util.StreamCharBuffer.readAsString(StreamCharBuffer.java:531)
    at org.codehaus.groovy.grails.web.util.StreamCharBuffer.toString(StreamCharBuffer.java:552)
    at org.codehaus.groovy.grails.web.pages.FastStringWriter.getValue(FastStringWriter.java:59)
    at org.codehaus.groovy.grails.web.pages.FastStringWriter.toString(FastStringWriter.java:55)
    at org.codehaus.groovy.grails.web.pages.GroovyPageParser.startTag(GroovyPageParser.java:1119)
    at org.codehaus.groovy.grails.web.pages.GroovyPageParser.page(GroovyPageParser.java:801)
    at org.codehaus.groovy.grails.web.pages.GroovyPageParser.generateGsp(GroovyPageParser.java:380)
    at org.codehaus.groovy.grails.web.pages.GroovyPageParser.parse(GroovyPageParser.java:326)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.buildPageMetaInfo(GroovyPagesTemplateEngine.java:584)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplate(GroovyPagesTemplateEngine.java:493)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplateWithResource(GroovyPagesTemplateEngine.java:473)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplate(GroovyPagesTemplateEngine.java:246)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplateForUri(GroovyPagesTemplateEngine.java:373)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplateForUri(GroovyPagesTemplateEngine.java:345)
    at org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplate(GroovyPagesTemplateEngine.java:262)
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderWithTemplateEngine(GroovyPageView.java:146)
    at org.codehaus.groovy.grails.web.servlet.view.GroovyPageView.renderMergedOutputModel(GroovyPageView.java:81)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.renderViewForUrlMappingInfo(UrlMappingsFilter.java:260)
    at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:189)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPageFilter.java:245)
    at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFilter.java:134)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:104)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:69)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:69)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Thread.java:722)
4

4 回答 4

16

设置JAVA_OPTS系统属性:
Windows:SET JAVA_OPTS=-Dstringchararrayaccessor.disabled=true
Unix:export JAVA_OPTS=-Dstringchararrayaccessor.disabled=true

于 2014-01-28T12:53:04.007 回答
9

这很烦人,但可以安全地忽略,并在 2.1.1 和 2.2 中修复 - 有关详细信息,请参阅https://github.com/grails/grails-core/issues/2359

于 2013-01-24T21:12:38.673 回答
2

从我在源代码中看到的内容,您可以将 JVM 属性stringchararrayaccessor.disabled设置为true

于 2013-04-27T03:54:28.867 回答
1

修复了启动 Collabnet Subversion Edge Server 4.x 时观察到相同问题的人们。

猜猜添加 JAVA_OPTS=-Dstringchararrayaccessor.disabled=true 的正确位置不是 csvn 启动脚本,而是 tanukisoft wrapper conf。

又名,编辑 $csvn_home/data/conf/csvn-wrapper.conf 并添加,

wrapper.java.additional.x=-Dstringchararrayaccessor.disabled=true

(其中 x 依次未使用)

于 2014-05-06T18:09:20.367 回答