I have added one condition 开发者_运维问答on my HTML page that is
#{if userObject == null}
<a href="/login">Text</a>
#{/if}
The code is working fine on the dev mode and getting this error in PROD mode.
SEVERE: Cannot start in PROD mode with errors
java.lang.ClassFormatError: Invalid method Code length 65561 in class file Template_M1175588447$_run_closure1_closure2
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at play.templates.GroovyTemplate$TClassLoader.defineTemplate(GroovyTemplate.java:77)
at play.templates.GroovyTemplate.compile(GroovyTemplate.java:133)
at play.templates.TemplateLoader.scan(TemplateLoader.java:184)
at play.templates.TemplateLoader.scan(TemplateLoader.java:194)
at play.templates.TemplateLoader.scan(TemplateLoader.java:194)
at play.templates.TemplateLoader.getAllTemplate(TemplateLoader.java:164)
at play.Play.preCompile(Play.java:501)
at play.Play.init(Play.java:273)
at play.server.Server.main(Server.java:131)
Is there any way out on this
I believe your issue is not related to the code you added, but to having a template "too big" that goes over the allowed lines size (in Java) for a method.
Probably you are xtending big templates or your page is really long.
As said on the official Java documentation, that means the jvm tries to read a class file that is malformed. Thus, try to delete all class files, tmp folder and recompile.
精彩评论