ObjectDB ObjectDB

Enhancement API - NullPointerException

#1

Hi!

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

com.objectdb.Enhancer.enhance("my.package.Foo");

However, I get the following NullPointerException:

[ObjectDB 2.7.1_09] null
java.lang.NullPointerException
        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

 

 

edit
delete
#2

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
edit
delete
#3

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

edit
delete

Reply

To post on this website please sign in.