play framework 打包 war 异常: Unknown constant tag 105 in class file Template_2043$_run_closure1

用play 框架开发web 工程,要部署在tomcat 上,使用 war 命令

play war E:\code_test --exclude .svn:logs:tmp:bin:.git -o E:\test_war

通过命令会生成 tomcat 结构的目录的文件。 但是在打包的过程中我遇到了问题。

完整的错误提示

~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.2.7, http://www.playframework.org
~
~ Excluding these directories :
~  .svn
~  logs
~  tmp
~  bin
~  .git
CompilerOracle: exclude jregex/Pretokenizer.next
Listening for transport dt_socket at address: 8000
04:58:01,542 INFO  ~ Starting E:\java_code_to_war\cy_gr_code_test_2
04:58:03,378 INFO  ~ Precompiling ...
05:02:47,353 ERROR ~ Cannot start in PROD mode with errors
java.lang.ClassFormatError: Unknown constant tag 105 in class file Template_2043$_run_closure1
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at play.templates.GroovyTemplate$TClassLoader.defineTemplate(GroovyTemplate.java:95)
        at play.templates.GroovyTemplate.compile(GroovyTemplate.java:151)
        at play.templates.TemplateLoader.getAllTemplate(TemplateLoader.java:212)
        at play.Play.preCompile(Play.java:608)
        at play.Play.init(Play.java:304)
        at play.server.Server.main(Server.java:162)
~ Please fix compilation errors before packaging WAR

产生错误的原因是

route 路由里面的配置错了。可能存在中文的空格。 我是将路由的格式对齐,中间的空格删掉了一些,再打包就成功了。

调试过程中出现过

08:32:53,977 INFO  ~ Precompiling ...
08:37:58,683 ERROR ~ Cannot start in PROD mode with errors
java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file Template_2043$_run_closure1
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at play.templates.GroovyTemplate$TClassLoader.defineTemplate(GroovyTemplate.java:95)
        at play.templates.GroovyTemplate.compile(GroovyTemplate.java:151)
        at play.templates.TemplateLoader.getAllTemplate(TemplateLoader.java:212)
        at play.Play.preCompile(Play.java:608)
        at play.Play.init(Play.java:304)
        at play.server.Server.main(Server.java:162)
~ Please fix compilation errors before packaging WAR

期待已久的界面出现了。

09:42:52,604 INFO  ~ Precompiling ...
09:47:50,009 INFO  ~ Done.
~ Packaging current version of the framework and the application to E:\play_to_war\tcs_cy_gr_war ...
~ Done !
~
~ You can now load E:\play_to_war\tcs_cy_gr_war as a standard WAR into your servlet container
~ You can't use play standard commands to run/stop/debug the WAR application...
~ ... just use your servlet container commands instead
~
~ Have fun!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值