Jump to content

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


Recommended Posts

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

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
  • 3 weeks later...

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 months later...

Not sure if you were having the same issue as me but, I seem to have found the solution to linkage problem for opening jrxml files. It took me a while but it seems like you need to have your jrxml files in jasper project as it downloads the correct dependencies. If you're using Spring Boot or any other libraries along with Jasper, you could simply add your other project as a dependency to resolve issue related to classes.

Hope it helps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...