Home » Support » Forum » Error when using Object DB Java Agent

Error when using Object DB Java Agent

#1

Hello!

We are using the Java Agent while developing our application because it's not possible to tell IntelliJ to enhance the classes after compiling them. Without enhancing it's painfully slow. So we are using the agent as a workaround while JetBrains is investigating the issue.

Our production code is built with maven and the classes are compile time enhanced.

With the agent we have a problem. In a couple of our projects this exceptions gets thrown when we initialize logback:

Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "org/xml/sax/InputSource"
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1207)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:61)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:134)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:49)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:152)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:141)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:120)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:331)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:283)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:304)
at at.co.pjm.tracker.persistence.Polygon.<clinit>(Polygon.java:23)
at java.io.ObjectStreamClass.hasStaticInitializer(Native Method)
at java.io.ObjectStreamClass.computeDefaultSUID(ObjectStreamClass.java:1743)
at java.io.ObjectStreamClass.access$100(ObjectStreamClass.java:72)
at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:250)
at java.io.ObjectStreamClass$1.run(ObjectStreamClass.java:248)
at java.security.AccessController.doPrivileged(Native Method)
at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:247)
at com.objectdb.o.TDF.<init>(TDF.java:194)
at com.objectdb.o.ANT.V(ANT.java:858)
at com.objectdb.o.SCM.r(SCM.java:305)
at com.objectdb.o.JEW.aG(JEW.java:185)
at com.objectdb.JEnhancerAgent.transform(JEnhancerAgent.java:155)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
#2

The class loading conflict happens during calculating serialVersionUID:

at java.io.ObjectStreamClass.getSerialVersionUID(ObjectStreamClass.java:247)
at com.objectdb.o.TDF.<init>(TDF.java:194)
at com.objectdb.o.ANT.V(ANT.java:858)
at com.objectdb.o.SCM.r(SCM.java:305)
at com.objectdb.o.JEW.aG(JEW.java:185)

The Enhancer has to load referenced classes for this calculation, and apparently there is a conflict in loading a specific class that was already loaded by another class loader.

You may try as a workaround to define serialVersionUID for all enhanced classes explicitly, e.g.

    private static final long serialVersionUID = -403250971215465050L;
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login