JasperReports Scriptlet работает в предпросмотре, но не при компиляции - PullRequest
0 голосов
/ 02 апреля 2019

Я использую JasperReports последние пару недель, и я не могу реализовать Scriptlets, хотя я следовал инструкциям (например, https://community.jaspersoft.com/blog/scriptlet-example-jaspersoft-6x-begineers-hello-world-sample-example) до зубов.

Iу меня есть скриптлет с именем ImageFormatterScriptlet, сейчас я просто хочу, чтобы он запускался. Что он делает в предварительном просмотре, но НЕ при компиляции с использованием кода Java.

Я всегда получаю следующую ошибку:

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
C:\develop\eclipse-installations\integration1\eclipse\rm_requirementsTypes_1554205368772_548397.java:272: error: package enco.sox2.cdo.server.reports.internal.scriptlets does not exist
                value = ((enco.sox2.cdo.server.reports.internal.scriptlets.ImageFormatterScriptlet)parameter_ImageFormatterScriptlet_SCRIPTLET.getValue()).extractImagesAndSave(); //$JR_EXPR_ID=23$
                                                                          ^
C:\develop\eclipse-installations\integration1\eclipse\rm_requirementsTypes_1554205368772_548397.java:410: error: package enco.sox2.cdo.server.reports.internal.scriptlets does not exist
                value = ((enco.sox2.cdo.server.reports.internal.scriptlets.ImageFormatterScriptlet)parameter_ImageFormatterScriptlet_SCRIPTLET.getValue()).extractImagesAndSave(); //$JR_EXPR_ID=23$
                                                                          ^
C:\develop\eclipse-installations\integration1\eclipse\rm_requirementsTypes_1554205368772_548397.java:548: error: package enco.sox2.cdo.server.reports.internal.scriptlets does not exist
                value = ((enco.sox2.cdo.server.reports.internal.scriptlets.ImageFormatterScriptlet)parameter_ImageFormatterScriptlet_SCRIPTLET.getValue()).extractImagesAndSave(); //$JR_EXPR_ID=23$
                                                                          ^
3 errors
.
Filling out enco/sox2/rm/master_report.jrxml

Я думаю, что это может быть: невозможно разрешить в Type Jaspersoft Studio

, но это не так.

Я импортирую флягу, создаю скриптлет,но он всегда выбрасывает это исключение! Класс находится в указанной папке, и, поскольку он работает в режиме предварительного просмотра, я полностью ошеломлен.

Я использую Windows 7, JasperReports Plugin для Eclipse, 6.1.1 (я знаю,он устарел)

РЕДАКТИРОВАТЬ: Иногда выдается это исключение после перезапуска:

[ERROR] net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
enco.sox2.reportmanager.ReportException: net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
    at enco.sox2.reportmanager.ReportCommand.fillReport(ReportCommand.java:110)
    at enco.sox2.reportmanager.ReportCommand.export(ReportCommand.java:165)
    at enco.sox2.reportmanager.ReportCommand.export(ReportCommand.java:159)
    at enco.sox2.reportmanager.ReportManager.generateReportToStream(ReportManager.java:175)
    at enco.sox2.cdo.server.reports.service.CdoReportService.generateReportToStream(CdoReportService.java:87)
    at enco.sox2.workspace.cdo.server.internal.CreateReportIndication.responding(CreateReportIndication.java:103)
    at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:177)
    at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:93)
    at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:106)
    at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:346)
    at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:75)
    at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:66)
    at org.eclipse.net4j.signal.Signal.runSync(Signal.java:283)
    at org.eclipse.net4j.signal.Signal.run(Signal.java:162)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:115)
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriplets(DefaultScriptletFactory.java:90)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createScriptlets(JRFillDataset.java:512)
    at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:631)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.setParameters(BaseReportFiller.java:436)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:523)
    at net.sf.jasperreports.parts.subreport.SubreportFillPart.fill(SubreportFillPart.java:174)
    at net.sf.jasperreports.engine.part.FillPart.fill(FillPart.java:77)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillPart(PartReportFiller.java:406)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillParts(PartReportFiller.java:385)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillDetail(PartReportFiller.java:337)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillReport(PartReportFiller.java:280)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fill(PartReportFiller.java:214)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:91)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)
    at enco.sox2.reportmanager.ReportCommand.fillReport(ReportCommand.java:97)
    ... 16 more
Caused by: java.lang.ClassNotFoundException: enco.sox2.workspace.ImageFormatterScriptlet cannot be found by enco.sox2.jasperreports_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:174)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:114)
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:110)
    ... 33 more

!ENTRY enco.sox2.cdo.server.reports 4 0 2019-04-02 15:13:16.794
!MESSAGE net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
!STACK 0
enco.sox2.reportmanager.ReportException: net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
    at enco.sox2.reportmanager.ReportCommand.fillReport(ReportCommand.java:110)
    at enco.sox2.reportmanager.ReportCommand.export(ReportCommand.java:165)
    at enco.sox2.reportmanager.ReportCommand.export(ReportCommand.java:159)
    at enco.sox2.reportmanager.ReportManager.generateReportToStream(ReportManager.java:175)
    at enco.sox2.cdo.server.reports.service.CdoReportService.generateReportToStream(CdoReportService.java:87)
    at enco.sox2.workspace.cdo.server.internal.CreateReportIndication.responding(CreateReportIndication.java:103)
    at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.responding(CDOServerIndicationWithMonitoring.java:177)
    at org.eclipse.net4j.signal.IndicationWithMonitoring.responding(IndicationWithMonitoring.java:93)
    at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedOutput(IndicationWithResponse.java:106)
    at org.eclipse.net4j.signal.Signal.doOutput(Signal.java:346)
    at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:75)
    at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:66)
    at org.eclipse.net4j.signal.Signal.runSync(Signal.java:283)
    at org.eclipse.net4j.signal.Signal.run(Signal.java:162)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: net.sf.jasperreports.engine.JRException: Error loading scriptlet class: enco.sox2.workspace.ImageFormatterScriptlet.
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:115)
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriplets(DefaultScriptletFactory.java:90)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createScriptlets(JRFillDataset.java:512)
    at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:631)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.setParameters(BaseReportFiller.java:436)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:523)
    at net.sf.jasperreports.parts.subreport.SubreportFillPart.fill(SubreportFillPart.java:174)
    at net.sf.jasperreports.engine.part.FillPart.fill(FillPart.java:77)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillPart(PartReportFiller.java:406)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillParts(PartReportFiller.java:385)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillDetail(PartReportFiller.java:337)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fillReport(PartReportFiller.java:280)
    at net.sf.jasperreports.engine.fill.PartReportFiller.fill(PartReportFiller.java:214)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:91)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)
    at enco.sox2.reportmanager.ReportCommand.fillReport(ReportCommand.java:97)
    ... 16 more
Caused by: java.lang.ClassNotFoundException: enco.sox2.workspace.ImageFormatterScriptlet cannot be found by enco.sox2.jasperreports_1.0.0.qualifier
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
    at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForRealName(JRClassLoader.java:174)
    at net.sf.jasperreports.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:114)
    at net.sf.jasperreports.engine.scriptlets.DefaultScriptletFactory.getScriptlet(DefaultScriptletFactory.java:110)
    ... 33 more

Как я могу решить эту проблему?

Заранее спасибо.

...