如何解决LinkageError与JasperReports(6. *)? [英] How to resolve LinkageError with JasperReports (6.*)?
问题描述
e.g。我们得到:
net.sf.jasperreports.engine.JRException:...
pre>
导致:net.sf .jasperreports.engine.fill.JRExpressionEvalException:
评估源文本的表达式的错误:
$ P {REPORT_SCRIPTLET} .setTestRaw_LogOn_TstMsgOn(true,true)
导致:java.lang.LinkageError:loader约束违反:loader
(java / net / FactoryURLClassLoader的实例)先前为不同类型加载
,名称为org / slf4j / Logger
运行在具有JR插件v6.1.0 的 Eclipse(Kepler)预览中,但不与另一个使用5.5.1的Eclipse一起运行
显然,我们正在使用一些本身正在使用slf4j api进行日志记录的构建路径引用的自定义报告脚本。
似乎与同一类的另一个不同版本冲突(对于相同的底层加载隔离)。
解决方案例我遇到同样的问题,我通过在项目中的Build路径中添加Jars来解决问题:
- slf4j-api-1.7.12.jar
- slf4j-log4j12-1.7.12.jar
- slf4j-simple-1.7.12.jar
并添加 JasperReports库
和 JasperReports图书馆依赖关系
到项目
这些步骤
- 右键单击项目
- 构建Cath>配置构建路径
- 转到库并使用
添加添加jar外部JAR
- 使用
添加库添加JasperReport库和JasperReport库依赖关系
- 然后转到
订单和导出
并检查新添加的库和Jars,然后单击确定
您将得到如下结果:
e.g. we got:
net.sf.jasperreports.engine.JRException: ...
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"
running in Eclipse (Kepler) Preview with JR plugin v6.1.0, but not with another Eclipse running with 5.5.1.final
Obviously we are using some build-path-referenced custom report scriptlet which itself is using the slf4j api for logging.
It seems to be conflicting with another different version of the same class (for the same underlying class loading isolation).
I got the same problem and I solved it by adding those Jars in Build path in my project:
- slf4j-api-1.7.12.jar
- slf4j-log4j12-1.7.12.jar
- slf4j-simple-1.7.12.jar
and add also the JasperReports Library
and the JasperReports Library Dependencies
to the project
with these steps
- Right click in the project
- Build Cath > Configure Build Path
- go to libraries and add the jars using
Add External JARs
- Add the JasperReport Library and JasperReport Library Dependencies using
Add Library
- and then go to
Order and Export
and check the new added Libraries and Jars and click OK
you will get a result like that :
这篇关于如何解决LinkageError与JasperReports(6. *)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!