Enhancement API - NullPointerException



I am trying to use the Enhancement API from within my application like this:


However, I get the following NullPointerException:

[ObjectDB 2.7.1_09] null
        at com.objectdb.o.JER.f(JER.java:96)
        at com.objectdb.o.JEL.D(JEL.java:490)
        at com.objectdb.o.JEN.m(JEN.java:103)
        at com.objectdb.Enhancer.enhance(Enhancer.java:69)
        at com.objectdb.Enhancer.enhance(Enhancer.java:90)
        at my.package.Main.main(Main.java:34)

I checked the logs, but there is no more information than what is also printed to the console (see error above). I'm not sure what is happening, the class exists and trying the API with a non-existent class gives me the expected "is not found by the enhancer" error instead of this NullPointerException.

It seems to be similar to this issue: http://www.objectdb.com/database/issue/82




Are you trying to enhance classes that are packed in a jar file?

On the fly enhancement by calling com.objectdb.Enhancer.enhance(...) is only supported for classes in separate class files rather in jar files.

If this is the case, a better error message should be shown of course.

ObjectDB Support

That was indeed the case, the classes were in a JAR file. Thank you for the quick reply!