[#4861] - log4j linkage error

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Block
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
1

Cant preview report (.jrxml) files, getting error:
java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.log4j.spi.LoggingEvent.<init>(Ljava/lang/String;Lorg/apache/log4j/Category;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V" the class loader (instance of java/net/FactoryURLClassLoader) of the current class, org/apache/log4j/Category, and the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) for resolved class, org/apache/log4j/spi/LoggingEvent, have different Class objects for the type apache/log4j/Category;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V used in the signature
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.slf4j.impl.Log4jLoggerAdapter.log(Log4jLoggerAdapter.java:601)
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:133)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1568)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1541)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:263)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:248)
at net.sf.jasperreports.eclipse.util.ReportLoader.loadReport(ReportLoader.java:37)
at net.sf.jasperreports.eclipse.ui.ReportPreviewUtil$1.run(ReportPreviewUtil.java:49)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

AttachmentSize
Package icon issueDetails.zip43.2 KB
michail.ivanilov's picture
Joined: Jun 2 2015 - 11:44pm
Last seen: 6 years 4 months ago

2 Comments:

#1
AttachmentSize
Plain text icon system_details.txt2.81 KB
#2

This happens because the Java project which has the reports have a different version of log4j than JasperReports'.
I have managed to workaround it. What I did:
- Created another java project with no libraries
- Added a new linked folder which points to the original reports folder (on the advanced button in the new folder dialog)
- Created a dummy ant build.xml file with a single empty task
- In this new project, added a new Ant Builder:
- - In the main tab, set that build.xml
- - In the refresh tab, mark Specific resources, then select the original project's reports folder
- - In the targets tab, set the dummy target to all 4 events

Then JasperSoft will work when opening files in this other project, and saves will be visible in the original folder because the refresh.

Feedback