我正在尝试为静态java类型的模板引擎实现一种热插拔机制。我遵循Play!框架使用的相同方法来重新加载应用程序类。然而,我总是得到以下错误:
Caused by: java.lang.UnsupportedOperationException: class redefinition failed: attempted to change the schema (add/remove fields)
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:150)
at play.classloading.HotswapAgent.reload(HotswapAgent.java:21)
at com.greenlaw110.rythm.play.RythmPlugin$5.reload(RythmPlugin.java:226)
at com.greenlaw110.rythm.internal.compiler.TemplateClassLoader.detectChange(TemplateClassLoader.java:335)
... 19 more有没有人知道play如何在这个问题上生存下来?
发布于 2012-02-18 12:28:45
我想我有点明白发生了什么。Play的应用程序类加载器实际上无法承受这种错误。它所做的是在出现错误时重新启动Play,在此过程中,play将创建应用程序类加载器的新实例。我遵循了同样的过程,它被证明是有效的。
https://stackoverflow.com/questions/9335022
复制相似问题