problem with classes not found during PlayPlugin.enhance

谁说我不能喝 提交于 2019-12-13 15:29:00

问题


I'm experimenting with a basic bytecode enhancement in a Play plugin, but when it tries to operate on the ApplicationClasses.ApplicationClass that it's given, the class can't be found.

public void enhance(ApplicationClasses.ApplicationClass applicationClass)
    throws NotFoundException, IOException, CannotCompileException 
{
    ClassPool classPool = ClassPool.getDefault();
    CtClass ctClass = classPool.get(applicationClass.name);
    ...
}

The exception is

Oops: NotFoundException An unexpected error occured caused by exception NotFoundException: controllers.CRUD

play.exceptions.UnexpectedException: While applying AccessControlPlugin@1a5db4b on controllers.CRUD
        at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:215)
...
Caused by: javassist.NotFoundException: controllers.CRUD
        at javassist.ClassPool.get(ClassPool.java:436)
        at AccessControlPlugin.enhance(AccessControlPlugin.java:19)

The Play framework is calling the enhance method. Shouldn't it know better than to process classes that aren't available yet? How do I get this working?


回答1:


Does it help if you increase the plug-in's load order in play.plugins to 1000, i.e. after the built-in plug-ins? I haven't seen this problem with enhancement, although I have had problems with the plug-in's enhance method not being called for certain classes.



来源:https://stackoverflow.com/questions/4608883/problem-with-classes-not-found-during-playplugin-enhance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!