Play 1.4.3 - UnexpectedException:在应用类play.classloading.enhancers.LocalvariablesNamesEnhancer时

时间:2016-11-09 08:49:55

标签: playframework java-8

框架版本: 1.4.3
平台:Java 1.8.0_74,Ubuntu 16.04,64位

详细信息:
尝试将播放版本从1.2.7升级到1.4.3。不得不为1.4.3升级一些模块/库。

通过播放运行启动应用,导致以下异常:

@722hc68nl
Error during the 500 response generation

Oops: UnexpectedException
Unexpected error : While applying play.CorePlugin@1de5f259 on controllers.Application, caused by exception UnexpectedException: While applying class play.classloading.enhancers.LocalvariablesNamesEnhancer on controllers.Application

play.exceptions.UnexpectedException: While applying play.CorePlugin@1de5f259 on controllers.Application
    at play.plugins.PluginCollection.enhance(PluginCollection.java:656)
    at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:242)
    at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:165)
    at play.classloading.ApplicationClassloader.loadClass(ApplicationClassloader.java:83)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:166)
    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:425)
    at play.classloading.ApplicationClassloader.getAssignableClasses(ApplicationClassloader.java:466)
    at play.templates.GroovyTemplateCompiler.endTag(GroovyTemplateCompiler.java:363)
    at play.templates.TemplateCompiler.generate(TemplateCompiler.java:93)
    at play.templates.TemplateCompiler.compile(TemplateCompiler.java:15)
    at play.templates.GroovyTemplateCompiler.compile(GroovyTemplateCompiler.java:40)
    at play.templates.TemplateCompiler.compile(TemplateCompiler.java:28)
    at play.templates.TemplateLoader.load(TemplateLoader.java:81)
    at play.templates.TemplateLoader.load(TemplateLoader.java:176)
    at play.server.PlayHandler.serve500(PlayHandler.java:836)
    at Invocation.HTTP Request(Play!)
Caused by: play.exceptions.UnexpectedException: While applying class play.classloading.enhancers.LocalvariablesNamesEnhancer on controllers.Application
    at play.CorePlugin.enhance(CorePlugin.java:311)
    at play.plugins.PluginCollection.enhance(PluginCollection.java:651)
    ... 18 more
Caused by: javassist.CannotCompileException: by javassist.bytecode.BadBytecode: renderDelegate ()V in controllers.Application: conflict: *top* and java.lang.Object
    at javassist.CtBehavior.insertBefore(CtBehavior.java:777)
    at javassist.CtBehavior.insertBefore(CtBehavior.java:734)
    at play.classloading.enhancers.LocalvariablesNamesEnhancer.enhanceThisClass(LocalvariablesNamesEnhancer.java:251)
    at play.CorePlugin.enhance(CorePlugin.java:306)
    ... 19 more
Caused by: javassist.bytecode.BadBytecode: renderDelegate ()V in controllers.Application: conflict: *top* and java.lang.Object
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:111)
    at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:456)
    at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:438)
    at javassist.CtBehavior.insertBefore(CtBehavior.java:768)
    ... 22 more
Caused by: javassist.bytecode.BadBytecode: conflict: *top* and java.lang.Object
    at javassist.bytecode.stackmap.TypeData$BasicType.setType(TypeData.java:156)
    at javassist.bytecode.stackmap.Tracer.checkParamTypes(Tracer.java:930)
    at javassist.bytecode.stackmap.Tracer.doInvokeMethod(Tracer.java:801)
    at javassist.bytecode.stackmap.Tracer.doOpcode148_201(Tracer.java:595)
    at javassist.bytecode.stackmap.Tracer.doOpcode(Tracer.java:81)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:187)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:199)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:199)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:199)
    at javassist.bytecode.stackmap.MapMaker.traceException(MapMaker.java:221)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:182)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:199)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:164)
    at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:108)
    ... 25 more

2 个答案:

答案 0 :(得分:1)

这个问题似乎与javassist jar有关。

解决方案 - 1:
播放问题列表中建议的解决方案是在dependencies.yml中排除javassist jar。

require:
    - play: exclude:
       - org.javassist -> javassist *

链接:Issue# 1434

但是,这并没有解决我的问题。

解决方案-2 :( 更多解决方法
其中一个论坛建议此问题与方法的代码长度有关(在我的情况下为renderDelegate())。我已经重构了减少行数的方法。这解决了我的问题。

答案 1 :(得分:0)

检查您的局部变量是否已初始化。对于对象,即使在语义上没有必要,您也必须使用 null 来初始化它。

continue;