Frage

I am trying to implement a hotswap mechanism for a static java typed template engine. I follow the same approach used by Play!Framework to reload application classes. However I always get the following error:

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

Anyone has any idea how play can survive this issue?

War es hilfreich?

Lösung

I think I kind of understand what's going on. Play's application class loader can NOT survive this kind of error actually. What it does is to restart Play upon the error, in which process play will create an new instance of the application class loader. I followed the same process and it proved to work.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top