我正在通过Scala blog engine tutorial(yabe)玩游戏!框架,我遇到模板执行错误,在访问注释时引用GenericSignatureFormatError : null
。具体来说,错误页面显示:
Template execution error
Execution error occured in template /app/views/tags/display.html.
Exception raised was GenericSignatureFormatError : null.
In /app/views/tags/display.html (around line 14)
(14) | ${_arg?.comments.size() ?: 'no'}
This exception has been logged with id 666i6ifgg
控制台的堆栈跟踪如下所示。我可以在github master(43b195)的samples-and-tests/
内重现问题,如下所示:
% git clone https://github.com/playframework/play-scala.git
% cd play-scala/samples-and-tests/yabe
% play dependencies
~ play! 1.2, http://www.playframework.org
~ Resolving dependencies using /home/league/tmp/play-scala/samples-and-tests/yabe/conf/dependencies.yml,
~ play->scala 0.9 (from playLocalModules)
~ Installing resolved dependencies,
~ modules/scala-0.9 -> /usr/local/stow/play-1.2/share/play-1.2/modules/scala-0.9
~ lib/joda-time-1.6.jar
~ Done!
% play run
~ play! 1.2, http://www.playframework.org
~ Warning: conflict on command scala:console
~ Ctrl+C to stop
Listening for transport dt_socket at address: 8000
10:32:01,076 INFO ~ Starting /home/league/tmp/play-scala/samples-and-tests/yabe
10:32:01,079 WARN ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.scala)
10:32:01,080 INFO ~ Module scala is available (/home/league/tmp/play-scala/samples-and-tests/yabe/../..)
10:32:01,080 INFO ~ Module scala is available (/usr/local/stow/play-1.2/share/play-1.2/modules/scala-0.9)
10:32:02,515 WARN ~ You're running Play! in DEV mode
10:32:02,591 INFO ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
然后,加载http://localhost:9000/产生上述错误,使用此控制台输出:
@666i6ifgg
Internal Server Error (500) for request GET /
Template execution error (In /app/views/tags/display.html around line 14)
Execution error occured in template /app/views/tags/display.html. Exception raised was GenericSignatureFormatError : null.
play.exceptions.TemplateExecutionException
at play.templates.BaseTemplate.throwException(BaseTemplate.java:84)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:236)
at play.templates.GroovyTemplate$ExecutableTemplate.invokeTag(GroovyTemplate.java:346)
at /app/views/Application/index.html.(line:6)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:213)
at play.templates.Template.render(Template.java:26)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:657)
at play.mvc.ControllerDelegate.renderTemplateForScala(ControllerDelegate.java:46)
at play.mvc.results.Template.<init>(Template.scala:12)
at play.mvc.ScalaController.Template(ScalaController.scala:77)
at controllers.Application$.index(app/controllers.scala:27)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:540)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:498)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:492)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:469)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:157)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.reflect.GenericSignatureFormatError
at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:385)
at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:74)
at java.beans.MethodDescriptor.<init>(MethodDescriptor.java:58)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1196)
at java.beans.Introspector.getBeanInfo(Introspector.java:423)
at java.beans.Introspector.getBeanInfo(Introspector.java:189)
at java.beans.Introspector.getBeanInfo(Introspector.java:250)
at java.beans.Introspector.<init>(Introspector.java:404)
at java.beans.Introspector.getBeanInfo(Introspector.java:189)
at java.security.AccessController.doPrivileged(Native Method)
at /app/views/tags/display.html.(line:14)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:213)
... 16 more
答案 0 :(得分:2)
通过切换到Sun JDK,我能够解决这个问题。我没有意识到我的Ubuntu已经设置为使用OpenJDK。 installation guide声称任何一个应该有效。也许这是不真实的,或者我对与此版本的OpenJDK相关的特定错误感到不幸。
对于遇到此问题的其他人,update-java-alternatives -l
会显示可用的JDK;我明白了:
java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun
这些来自Ubuntu软件包
sun-java6-bin 6.24-1build0.10.10.1
openjdk-6-jre-headless 6b20-1.9.7-0ubuntu1
使用此选项:
update-java-alternatives -s java-6-sun
答案 1 :(得分:0)
尝试更改此内容:
${_arg?.comments.size() ?: 'no'}
到
${(_arg?.comments.size() > 0) ? '': 'no'}
这应该有用。