How to solve java.lang.LinkageError: loader constraint violation

Hi I'm new to jasperreport I added its plugin to my eclipse IDE but when i come to create a new report i get the folloiwng error
java.lang.LinkageError: loader constraint violation: when resolving method 'org.slf4j.spi.MDCAdapter org.slf4j.MDC.getMDCAdapter()' the class loader java.net.FactoryURLClassLoader @133a8a9f of the current class, ch/qos/logback/classic/spi/LoggingEvent, and the class loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @2478dbba for the method's defining class, org/slf4j/MDC, have different Class objects for the type org/slf4j/spi/MDCAdapter used in the signature (ch.qos.logback.classic.spi.LoggingEvent is in unnamed module of loader java.net.FactoryURLClassLoader @133a8a9f, parent loader org.eclipse.osgi.internal.framework.ContextFinder @6192a5d5; org.slf4j.MDC is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @2478dbba, parent loader 'platform')
    at ch.qos.logback.classic.spi.LoggingEvent.getMDCPropertyMap(LoggingEvent.java:408)
    at ch.qos.logback.classic.spi.LoggingEvent.prepareForDeferredProcessing(LoggingEvent.java:256)
    at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:226)
    at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)
    at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:85)
    at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
    at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
    at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
    at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:426)
    at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
    at ch.qos.logback.classic.Logger.log(Logger.java:780)
    at org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog.debug(LogAdapter.java:459)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1560)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1542)
    at com.jaspersoft.studio.editor.AbstractJRXMLEditor.doInitModel(AbstractJRXMLEditor.java:301)
    at com.jaspersoft.studio.editor.AbstractJRXMLEditor.init(AbstractJRXMLEditor.java:245)
    at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:353)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:344)
anyhelp I'll be thankfull

sabrine.baameur's picture
Joined: Mar 8 2023 - 12:58pm
Last seen: 3 days 9 hours ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

arai_4 - 4 months 2 weeks ago

Thank you waiting forward for your help

sabrine.baameur - 4 months 2 weeks ago

@aria_4 any news?

sabrine.baameur - 4 months 1 week ago
show 3 more...

im also facing the same issue , need help on this 

charuseelan - 4 months 1 week ago

Thank you for your patience, we need a little more time with our team of experts to come up with a solution. We will respond back as soon as we have an answer to your question.

arai_4 - 4 months 3 days ago

Still facing the same issue except that sometimes instead of the previous message error i get the following:

Description Resource Path Location Type
Class net.sf.jasperreports.engine.xml.JRReportSaxParserFactory should be compatible with net.sf.jasperreports.engine.xml.JRSaxParserFactory
Any updates i'll be thankfull

sabrine.baameur - 3 months 1 week ago

2 Answers:

This issue can occur with conflicting library versions.

As per the error it seems there are conflicting versions of the SLF4J (Simple Logging Facade for Java) library in the classpath. The error message suggests that the LoggingEvent class, is attempting to access the a method, but the class loaders for class (org.slf4j.MDC) and the class trying to access it have different Class objects for the org.slf4j.spi.MDCAdapter type.

It seems that the conflict is there with the SLF4J logging library with JasperReports. To resolve the issue, check SLF4J versions you have, remove any conflicting/duplicate libraries, and ensuring compatibility with JasperReports and other plugins you already have.

jmand's picture
112
Joined: Feb 8 2023 - 11:19am
Last seen: 1 hour 42 min ago

Hi,

any updates cause i'm still facing the same problem and what i noticed is that just before the problem mentioned before raises i get this error:
net.sf.jasperreports.engine.JRRuntimeException: Class net.sf.jasperreports.engine.xml.JRReportSaxParserFactory should be compatible with net.sf.jasperreports.engine.xml.JRSaxParserFactory.
    at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.getFactory(BaseSaxParserFactory.java:269)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1563)
    at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1542)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:238)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:223)
    at net.sf.jasperreports.eclipse.util.ReportLoader.loadReport(ReportLoader.java:28)
    at net.sf.jasperreports.eclipse.ui.ReportPreviewUtil$1.run(ReportPreviewUtil.java:40)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4029)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
I don't know if it has a connection with the other error or not
any siggetions i'll be thankful

sabrine.baameur's picture
Joined: Mar 8 2023 - 12:58pm
Last seen: 3 days 9 hours ago
Feedback