Failed to enhance dynamic type

#1

Hi,

We are trying to enhance a class with OSGI Weaver using the JEnhancer.THIS instance as a class transformer. Works very well except for some entities, i.e. we do have an entity which has:

@Override
public String getQubletHeadingMain(LanguageContext context)

This is a simple implementation of our custom interface and should of course, NOT be enhanced. Yet, we get an error due enhancing:

Failed to generate dynamic type com.quasado.galaxy.foundation.api.language.LanguageContext

I am curious why he does even try to generate dynamic type?? Can he simply ignore such things and enhance the regular getters and setter of my entity without error?

Alex

#2

Is it possible that this specific class is referenced from a class that has to be enhanced (an entity class) and it is not available in the classpath during enhancement?

When a class is missing, ObjectDB Enhancer tries to overcome this by generating a dynamic synthetic type. Usually it succeed but in some cases it fails (if you have an exception stack trace in the log it may help understanding why it has failed in this specific case).

ObjectDB Support
#3

Hi,

the class is referenced from an entity class during the method parameter.

it is not supposed to be in the classpath at that moment and I am curious why the ObjectDB Enhancer even cares about my non-jpa methods (it is not a Bean Getter nor Setter) wo why not simply ignoring that method? This would be at least what we'd expect to happen. Can u provide some help for this?

thanks

Alex

#4

Classes for enhancement are loaded into the JVM for analysis (annotation extraction, serialversionUID calculation, etc.). Class loading fails (by the JVM) if referenced classes are missing.

Usually ObjectDB can work around by generating synthetic classes where classes are missing. I don't know why this process fails in your specific case, but if you provide a test case that demonstrates it - it might be possible to improve synthetic class generation to avoid this exception.

ObjectDB Support

Reply