我有一个控制器,它接收异步生成CSV的请求,并给出了异常的延续:
Oops: UnexpectedException
An unexpected error occured caused by exception UnexpectedException:
While applying class play.classloading.enhancers.LocalvariablesNamesEnhancer on
controllers.Productions
我设法将问题缩小到await线。如果我删除它,我不会得到例外。任何人都可以帮助我进一步调试问题或建议解决方法吗?
制作控制器:
@Check("user")
public static void exportz(int iDisplayStart, int sEcho, String sSearch,
String searchFields) {
ObjectType ztype = ObjectType.get(getControllerClass());
Triple<String,String,String> triplet = parseListJSON(iDisplayStart, sEcho, sSearch, searchFields);
String where = triplet.getLeft();
String orderField = triplet.getMiddle();
String orderDir = triplet.getRight();
ExportCSV csvGen = new ExportCSV( ztype, where, orderField,orderDir,sSearch,searchFields);
response.contentType = "text/csv";
do {
Promise<String> csvGeneration =csvGen.now();
String someCsvData = await(csvGeneration);
response.writeChunk(someCsvData);
}while(csvGen.moreData());
}
例外:
Oops: UnexpectedException
An unexpected error occured caused by exception UnexpectedException: While applying class play.classloading.enhancers.LocalvariablesNamesEnhancer on controllers.Productions
play.exceptions.UnexpectedException: While applying play.CorePlugin@7e6b9547 on controllers.Productions
at play.plugins.PluginCollection.enhance(PluginCollection.java:556)
at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:235)
at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:167)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:431)
at play.Play.preCompile(Play.java:593)
at play.Play.init(Play.java:299)
at play.server.Server.main(Server.java:159)
Caused by: play.exceptions.UnexpectedException: While applying class play.classloading.enhancers.LocalvariablesNamesEnhancer on controllers.Productions
at play.CorePlugin.enhance(CorePlugin.java:302)
at play.plugins.PluginCollection.enhance(PluginCollection.java:551)
... 6 more
Caused by: javassist.CannotCompileException: by javassist.bytecode.BadBytecode: invalid opcode address
at javassist.CtBehavior.insertAfter(CtBehavior.java:777)
at play.classloading.enhancers.LocalvariablesNamesEnhancer.enhanceThisClass(LocalvariablesNamesEnhancer.java:269)
at play.CorePlugin.enhance(CorePlugin.java:297)
... 7 more
Caused by: javassist.bytecode.BadBytecode: invalid opcode address
at javassist.bytecode.CodeIterator.nextOpcode(CodeIterator.java:586)
at javassist.bytecode.CodeIterator.next(CodeIterator.java:157)
at javassist.bytecode.stackmap.Liveness.analyze(Liveness.java:237)
at javassist.bytecode.stackmap.Liveness.computeUsage(Liveness.java:216)
at javassist.bytecode.stackmap.Liveness.compute(Liveness.java:38)
at javassist.bytecode.stackmap.TypedBlock.makeBlocks(TypedBlock.java:54)
at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:91)
at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:404)
at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:389)
at javassist.CtBehavior.insertAfter(CtBehavior.java:768)
... 9 more
答案 0 :(得分:3)
好吧,我解决了将方法更改为新控制器的问题。我认为LocalvariablesNamesEnhancer是PlayFramework上最古老的错误之一,可能永远无法解决。