Problem of Enhancer with JAXB / Proxified Entity Bean.

#1

Hello Support,

I run on a prod server an objectdb java agent with my app.

In this application, all my entities beans are constructed from a JAXBContext ( SOAP CXF Webservice or Direct JAXB Unmarshalling )

When i watch the objectdb log, i see pages of errors.

Not Enhanced: com/test/MyBean$JaxbAccessorF_name: com.objectdb.o.TEX: Type com.test.MyBean$JaxbAccessorF_name is not found
        at com.objectdb.o.MSG.e(MSG.java:107)
        at com.objectdb.o.SCM.w(SCM.java:460)
        at com.objectdb.o.JEW.aK(JEW.java:160)
        at com.objectdb.JEnhancerAgent.transform(JEnhancerAgent.java:155)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:424)
        at java.lang.ClassLoader.defineClass1(Native Method) << Definition of a new class wake up JEnhancerAgent
        ...
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:515)

I observed that the Enhancer is unable to process dynamic class created with JAXB, so my beans aren't correctly enhanced ...

Also, I have just tested some beans created from a CGLIB proxy, same problem.

Have you a solution to make the enhancer work correctly with JAXB and more generally with proxified beans ?

#2

To enhance a class, all the classes that are referenced from that class must also be available in the classpath (or by the same class loader). This is because the class is first loaded by Java and only then explored (using reflection) by the ObjectDB Enhancer. Changing this will not be easy.

In our tests we also use enhancement of dynamically generated classes. We do not use JAXB or CGLIB, but classes that are generated dynamically can be enhanced, if they do not reference a missing class.

The error message that you get specifies JaxbAccessorF_name as the missing type.

We may be able to add to the Enhancer ability to ignore fields of specific types, but we need more information on the exact classes that should be ignored.

ObjectDB Support
#3

Hello,

I just found a workaround for JAXB, just add on JVM launch :

-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true

So the problem doesn't happen anymore with my beans.

Thx support,

Regards,

Xirt

#4

Thank you for this update.

ObjectDB Support

Reply