You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Rachana Srivastava <Ra...@markmonitor.com> on 2015/11/03 19:52:29 UTC

Frozen exception while dynamically creating classes inside Spark using JavaAssist API

I am trying to dynamically create a new class in Spark using javaassist API. The code seems very simple just invoking makeClass API on a hardcoded class name. The code works find outside Spark environment but getting this chedkNotFrozen exception when I am running the code inside Spark
Code Excerpt:
ClassPool pool = ClassPool.getDefault()
CtClass regExClass= pool.makeClass("TestClass14",baseFeatureProcessor)
Exception Details:
###################### Exception make Class
java.lang.RuntimeException: TestClass14: frozen class (cannot edit)
    at javassist.ClassPool.checkNotFrozen(ClassPool.java:617)
    at javassist.ClassPool.makeClass(ClassPool.java:859)