我遇到了使用Jasper Reports在JBoss 6中加载类的问题。我们有一个多耳应用程序,其中两个耳朵每个都包含一个jasperreports-4.5.0.jar的副本(jar版本相同,如md5校验和所示)位于Ears根目录下的lib文件夹中。
直到大约3个星期前,当团队中的某个人进行了大规模登记以更改某些日期/时间格式时,事情一直很好。从那时起,尝试从其中一个耳朵运行Jasper报告总是失败,并且堆栈跟踪相同:
java.lang.ExceptionInInitializerError
at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:83) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:153) [:5.1.0]
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82) [:5.1.0]
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653) [:5.1.0]
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969) [:5.1.0]
at com.landslide.reports.LandslideReport.printJasperReport(LandslideReport.java:411) [:]
at com.landslide.reports.LandslideReport.generateReport(LandslideReport.java:362) [:]
at com.landslide.reports.LandslideReport.exportToByteStream(LandslideReport.java:228) [:]
at com.landslide.reports.LandslideReport.exportToByteStream(LandslideReport.java:217) [:]
at com.landslide.common.delegate.MyListDelegate.createPDFDocumentForMyList(MyListDelegate.java:2491) [:]
at com.landslide.scheduledreport.ScheduledReportRun.getPdfFromMyList(ScheduledReportRun.java:367) [:]
at com.landslide.scheduledreport.ScheduledReportRun.run(ScheduledReportRun.java:197) [:]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [:1.6.0_39]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [:1.6.0_39]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_39]
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Class net.sf.jasperreports.extensions.DefaultExtensionsRegistry does not implement/extend net.sf.jasperreports.extensions.ExtensionsRegistry
at net.sf.jasperreports.engine.util.ClassUtils.instantiateClass(ClassUtils.java:56) [:5.1.0]
at net.sf.jasperreports.extensions.ExtensionsEnvironment.createDefaultRegistry(ExtensionsEnvironment.java:81) [:5.1.0]
at net.sf.jasperreports.extensions.ExtensionsEnvironment.<clinit>(ExtensionsEnvironment.java:69) [:5.1.0]
... 19 more
尝试使用其他耳朵中的Jasper Reports功能。
当违规的耳朵自行展开时,一切都很顺利。我猜测类加载已经“混乱”了,当尝试初始化Jasper Extensions注册表时,接口类要么找不到,要么来自另一个耳朵的jasper库并且失败了Jasper instantiateClass调用。
我已经尝试将Jasper库重新推向最新版本(5.1.0),并尝试使用包含在耳中的战争中的jboss.classsloading.xml文件以及耳朵本身,以尝试强制类加载器隔离,但没有运气。
有什么建议吗?
谢谢,
- Dave Swindell