Category: | Bug report |
Priority: | High |
Status: | Confirmed |
Project: | Severity: | Major |
Resolution: | Reopened |
|
Component: | Reproducibility: | Always |
Assigned to: |
net.sf.jasperreports.engine.JRException: 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 com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:466)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:441)
at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:333)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: 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.error(SLF4JLocationAwareLog.java:225)
at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:801)
at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:156)
at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:400)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:151)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:332)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummaryNoLastFooterSamePage(JRVerticalFiller.java:1102)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:1065)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:198)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120)
at java.lang.Thread.run(Thread.java:724)
10 Comments:
This exception itself is pretty useless.
Please attach a possible sample report, steps to reproduce the problem and detailed information on which version of JSS you used, OS, platform etc.
Regards,
Massimo.
I'm not the case opener but I'm getting the same exact error on the attached report.
When it happens: As soon as I try to switch to Preview tab of the report(which doesn't have that much, don't think it's jrxml problem).
JSS version: 6.0.0.final
IDE: Eclipse Kepler SR2 (4.3.2) with STS 3.6.3.201411281414-RELEASE-e43
OS: Windows 7 Enterprise SP1
Java: 1.7
Let me know if you need more info
---------------------------------------------------
UPDATE: The error does mean something after digging through my classpath, slf4j-log4j12.jar is the culprit for this issue causing the failure to preview error.
This sounds more of a bug so I'm changing the ticket status accordingly.
I also am experiencing this error. My environment is almost identical to that of kabdelsalam. The error occurs when I attempt to create a jasper file in the src/main/resources folder. I have just installed Jasper Studio and this is my first attempt to create a jrxml file. Note: my pom includes slf4j-log4j12.jar.
Thanks,
For this issue, will you release a new version of the plugin? Yesterday, I updated Jaspersoft Studio from 6.0.0 to 6.0.1. I was able to build the jrxml, but I experienced the error when I attempted to compile.
Thanks,
Mike
I tried statement.jrxml report on JSS 6.0.4 and it works fine, please retest on 6.0.4
I'll close the bug, if you still have the problem, please reopen it, provide more details and a sample
still happens in Eclipse (Kepler) Preview with 6.1.0, but not with another Eclipse running with 5.5.1.final ... for us it's the usage of org.slf4j.Logger (having slf4j-api-1.7.5.jar and slf4j-simple-1.7.5.jar in the build path or having both removed - does not matter. where these are called by a custom scriptlet)
running Eclipse with the eclipse.ini jvm option "-Dverbose:class" shows that the conflict may be related to this other loaded class (wherever it is loaded (maybe used by jasper preview editor itself): eclipse/plugins/org.slf4j.api_1.7.2.v20121108-1250.jar)
I suppose Jasper uses SLF4J since v6 and does not isolate its class loading of report-specific classes/libs with a separate class loader from its own class versions (or the ones provided by the Eclipse installation) and thus such linkage errors (e.g. http://stackoverflow.com/questions/244482/how-to-deal-with-linkageerrors...) may be caused.
Exception details:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $P{REPORT_SCRIPTLET}.setTestRaw_LogOn_TstMsgOn(true, true)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $P{REPORT_SCRIPTLET}.setTestRaw_LogOn_TstMsgOn(true, true)
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of java/net/FactoryURLClassLoader) previously initiated loading for a different type with name "org/slf4j/Logger"
Posted this also here: http://stackoverflow.com/a/31719746/1915920
I am currently using Jasper Studio version 6.2.1 and the issue still exists. It is really a pain to make it work and I am still stuck at it.
Same for me, the issue is still present on Jasper Studio 6.3.1. I'm using a BeanDataAdapter for testing reports. Whenever I make a change to the DataAdapter and try to view the report preview I'm getting the error mentioned below. The problem can only be solved by restarting Eclipse (which is a total pain if you have large workspace with 300+ modules). Thus, JasperReports is currently unusable for me.
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $F{header}.getPostalAddress()
at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:548)
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of net/sf/jasperreports/engine/util/JRClassLoader) previously initiated loading for a different type with name "foo.bar.MyClass"
at MaterialReport_1481274379408_337847.evaluate(MaterialReport_1481274379408_337847:257)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:276)
... 14 more
Wow, so many years and no fix yet?
Well I was trying to fix it myself.
(My changes can be seen at https://github.com/TheCrazyT/jaspersoft-studio-ce/commit/8b500f7a79aa6f9....
But I doubt it is currently in a perfect state that should be used in production environment)
Testcase is located at: https://gist.github.com/TheCrazyT/40b615aff09cda175af0c56d68201f25
To make it easier I created the Logger-Class itself
I know that this is no normal case, but it makes no difference if you define the class in source or add the slf4j dependency.
The problem is, that the preview seems to priorize the classes of the eclipse environment (because those classes are already loaded).
In the Testcase the Logger-Class normaly gets choosen by the EquinoxClassLoader(eclipse-internal) instead of the URLClassLoader that gets used by JavaProjectClassLoader.
Thats why my code skips the class if it has EquinoxClassLoader as ClassLoader.
(Exceptions are classes used by jasper itself "net.sf.jasperreports")
Hi CrazyT, thanks for providing a possible solution and test case.
We will try to look into it for the next releases.
Regards,
Massimo.