在PlayPlugin.enhance期间找不到类的问题

时间:2011-01-05 20:31:53

标签: plugins playframework bytecode-manipulation javassist

我正在试验Play插件中的基本字节码增强功能,但是当它尝试对它给出的ApplicationClasses.ApplicationClass进行操作时,无法找到该类。

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

例外是

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)

Play框架正在调用enhance方法。难道它不应该比处理尚不可用的类更好吗?我如何使这个工作?

1 个答案:

答案 0 :(得分:0)

如果将插件的加载顺序在play.plugins增加到1000,即在内置插件之后,它会有帮助吗?我没有看到增强的这个问题,虽然我遇到了插件的增强方法没有被某些类调用的问题。