播放中出现 GenericSignatureFormatError! Scala 博客示例

发布于 2024-11-02 00:43:25 字数 4587 浏览 0 评论 0原文

我正在学习 Play 的 Scala 博客引擎教程 (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),如下:

% 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

I'm working my way through the Scala blog engine tutorial (yabe) for Play! Framework, and I encountered a template execution error that refers to GenericSignatureFormatError : null when accessing comments. Specifically, the error page says:

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

The stack trace from the console is below. I can reproduce the problem within samples-and-tests/ from the github master (43b195), as follows:

% 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) ...

Then, loading http://localhost:9000/ produces the error stated above, with this console output:

@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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

微凉徒眸意 2024-11-09 00:43:25

我通过切换到 Sun JDK 解决了这个问题。我没有意识到我的 Ubuntu 被设置为使用 OpenJDK。 安装指南声称任一版本都可以工作。也许这是不真实的,或者也许我运气不好,遇到了与这个版本的 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

I was able to work around this problem by switching to the Sun JDK. I didn't realize that my Ubuntu was set to use OpenJDK instead. The installation guide claims that either one should work. Perhaps that is untrue, or perhaps I got unlucky with a particular bug related to this version of OpenJDK.

For anyone else having this problem, update-java-alternatives -l shows the available JDKs; I see:

java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun

These come from the Ubuntu packages

sun-java6-bin          6.24-1build0.10.10.1
openjdk-6-jre-headless 6b20-1.9.7-0ubuntu1

Use this to select:

update-java-alternatives -s java-6-sun
海螺姑娘 2024-11-09 00:43:25

尝试将其更改为:

${_arg?.comments.size() ?: 'no'} 

${(_arg?.comments.size() > 0) ? '': 'no'} 

应该可行。

Try changing this:

${_arg?.comments.size() ?: 'no'} 

to

${(_arg?.comments.size() > 0) ? '': 'no'} 

This should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文