bikerpfanne Posted August 4, 2019 Share Posted August 4, 2019 Hi ppl,after days spending solving problem I want to ask the community.Given :4 Reports : reportA, reportFirmen, reportGroup, reportPositionreportA includes reportFirmen and reportGroupreportGroup includes reportPositionAll of Reports works fine in iReport Designer 5.6.0 and in TIBCO Jaspersoft® Studio 6.9.0 - Visual Designer for JasperReports 6.9.0. But in Java Application (WebbApp) not with following Error Maven (tried with 6.8.0, 6.2.0 and 5.0.4 no difference) : <!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports --><dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports</artifactId> <version>6.8.1</version></dependency> Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/position") at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:284) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:316) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:672) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:640) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1169) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:522) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:350) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:548) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2583) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:813) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:433) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:818) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61) at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 moreCaused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRDataSource at reportGroup_1564933204729_909292.evaluate(reportGroup_1564933204729_909292:211) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:302) ... 19 moreCaused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRDataSource at java.lang.ClassLoader.findClass(ClassLoader.java:530) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 21 moreAll Reports have Langueg=JavaI pass SubReport Directory correctlyFirst Level works really fine in JavaApp too (Groups and Firms are in the Report)Creation of Datasoruce from reportA for reportGroup works in JavaApp and iReport((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/group")The Problem is creating new Datasoruce in reportGroup from reportPosition((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/position")it works ONLY in ireportif I do not pass/create this DS, everything works with empty positions List in subreport.Tank a lot ! <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportA" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="98ea4eeb-12cc-4fb5-bc82-c9ec2757e85b"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["/Users/leo/IdeaProjects/gitlabinnoweb/innoweb/src/main/resources/reports/"]]></defaultValueExpression> </parameter> <queryString language="xPath"> <![CDATA[/xmldata/group]]> </queryString> <field name="presimage" class="java.lang.String"> <fieldDescription><![CDATA[/xmldata/presimage]]></fieldDescription> </field> <field name="id" class="java.lang.String"> <fieldDescription><![CDATA[id]]></fieldDescription> </field> <field name="name" class="java.lang.String"> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="122" splitType="Stretch"> <image> <reportElement x="50" y="0" width="100" height="50" uuid="34a2b359-27cd-47a1-91cc-8e5da3128eee"/> <imageExpression><![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{presimage}.getBytes()))]]></imageExpression> </image> <subreport> <reportElement x="0" y="93" width="555" height="29" uuid="4e9e407e-1731-4ede-a0a1-55c55dd830a4"/> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/xmldata/firmen/firm")]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "reportFirmen.jasper"]]></subreportExpression> </subreport> <textField> <reportElement x="100" y="63" width="455" height="20" uuid="e7ee3b21-795f-4984-9cca-5c4a174808ad"/> <textFieldExpression><![CDATA[$P{SUBREPORT_DIR}]]></textFieldExpression> </textField> <staticText> <reportElement x="0" y="63" width="100" height="20" uuid="b2c187c6-e5dc-4d9c-8f4c-77a5279fbcd6"/> <text><![CDATA[subreport dir]]></text> </staticText> </band> </title> <detail> <band height="62" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="100" height="20" uuid="5999312c-1ad7-415c-a021-cd15b5c311cc"/> <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression> </textField> <textField> <reportElement x="100" y="0" width="363" height="20" uuid="e944d6c0-5785-4276-9b04-dee7e2c040a8"/> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> <subreport> <reportElement x="0" y="20" width="555" height="42" uuid="5b11fe21-104d-41b0-8e35-7612df9ac9c3"/> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/group")]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "reportGroup.jasper"]]></subreportExpression> </subreport> </band> </detail></jasperReport>[/code]<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportFirmen" pageWidth="555" pageHeight="802" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="7d5ebcce-f74b-48e5-a09b-4b65c6af948c"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <queryString language="xPath"> <![CDATA[/xmldata/firmen/firm]]> </queryString> <field name="name" class="java.lang.String"> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <field name="info" class="java.lang.String"> <fieldDescription><![CDATA[/xmldata/firmen/info]]></fieldDescription> </field> <title> <band height="23"> <textField> <reportElement x="222" y="0" width="333" height="20" uuid="1fff2be9-b525-4b31-95cc-7e654c4ed6f8"/> <textFieldExpression><![CDATA[$F{info}]]></textFieldExpression> </textField> <staticText> <reportElement x="122" y="0" width="100" height="20" uuid="3b116953-f269-489a-bc42-341b98e7e163"/> <text><![CDATA[Alle Lieferanten]]></text> </staticText> </band> </title> <detail> <band height="23" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="213" height="20" uuid="32b13a2b-c4c2-4c87-a9d7-39f464a9785f"/> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportGroup" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="0" bottomMargin="0" uuid="5a823ffc-bb97-44a4-88b6-7fd7e13a49ab"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA["/Users/leo/IdeaProjects/gitlabinnoweb/innoweb/src/main/resources/reports/"]]></defaultValueExpression> </parameter> <queryString language="xPath"> <![CDATA[/xmldata/group/group]]> </queryString> <field name="id" class="java.lang.String"> <fieldDescription><![CDATA[id]]></fieldDescription> </field> <field name="name" class="java.lang.String"> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <field name="totalprice" class="java.lang.String"> <fieldDescription><![CDATA[totalprice]]></fieldDescription> </field> <title> <band height="25"> <textField> <reportElement x="0" y="0" width="555" height="20" uuid="e7c1dae2-1d7f-4e51-8876-caf84aab3602"/> <textFieldExpression><![CDATA[$P{SUBREPORT_DIR}]]></textFieldExpression> </textField> </band> </title> <detail> <band height="82" splitType="Stretch"> <textField> <reportElement x="100" y="13" width="393" height="20" uuid="4e65c336-9c12-4bf5-9cd8-53a2964c08a9"/> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="13" width="100" height="20" uuid="c29fc9f8-f386-441b-b5fa-515de2a77c4f"/> <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression> </textField> <subreport> <reportElement x="0" y="33" width="555" height="38" uuid="ec08d032-8cde-4a66-9bd8-bb0e82c55731"/> <dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/position")]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "reportPosition.jasper"]]></subreportExpression> </subreport> </band> </detail> <lastPageFooter> <band height="25"> <staticText> <reportElement x="320" y="0" width="100" height="20" uuid="539df4fc-c828-4e1b-829d-7863e2c88f3d"/> <text><![CDATA[total group price]]></text> </staticText> <textField> <reportElement x="420" y="0" width="100" height="20" uuid="668abe45-de36-4e16-8a5e-e5d5b2ba2a5f"/> <textFieldExpression><![CDATA[$F{totalprice}]]></textFieldExpression> </textField> </band> </lastPageFooter></jasperReport>[/code] <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportPosition" pageWidth="555" pageHeight="802" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="9c3067ff-301b-4853-b1dd-b60f86f10881"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <queryString language="xPath"> <![CDATA[/xmldata/group/group/position]]> </queryString> <field name="id" class="java.lang.String"> <fieldDescription><![CDATA[id]]></fieldDescription> </field> <field name="name" class="java.lang.String"> <fieldDescription><![CDATA[name]]></fieldDescription> </field> <field name="amount" class="java.lang.String"> <fieldDescription><![CDATA[amount]]></fieldDescription> </field> <field name="unit" class="java.lang.String"> <fieldDescription><![CDATA[unit]]></fieldDescription> </field> <field name="price" class="java.lang.String"> <fieldDescription><![CDATA[price]]></fieldDescription> </field> <field name="totalprice" class="java.lang.String"> <fieldDescription><![CDATA[totalprice]]></fieldDescription> </field> <field name="image" class="java.lang.String"> <fieldDescription><![CDATA[image]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <columnHeader> <band height="24" splitType="Stretch"> <staticText> <reportElement x="0" y="2" width="40" height="20" uuid="632fa471-23ca-48e6-acc2-908f1c94c37e"/> <text><![CDATA[id]]></text> </staticText> <staticText> <reportElement x="40" y="2" width="207" height="20" uuid="6e1e4604-29b9-4e52-9dfc-85a1f809c78d"/> <text><![CDATA[name]]></text> </staticText> <staticText> <reportElement x="247" y="0" width="100" height="20" uuid="86ef3c1e-3c8b-4a3f-b952-56ed8fa3ecb2"/> <text><![CDATA[amount]]></text> </staticText> <staticText> <reportElement x="347" y="2" width="43" height="20" uuid="1bbf1120-80f1-4062-8b6f-a686e742e9d0"/> <text><![CDATA[unit]]></text> </staticText> <staticText> <reportElement x="390" y="2" width="67" height="20" uuid="2e2663b8-1682-46f8-b114-9c185c6c5cc1"/> <text><![CDATA[price]]></text> </staticText> <staticText> <reportElement x="457" y="2" width="98" height="20" uuid="f117df4d-aa82-4f98-a44a-63f1c9c8bcde"/> <text><![CDATA[totalprice]]></text> </staticText> </band> </columnHeader> <detail> <band height="67" splitType="Stretch"> <image scaleImage="RealSize"> <reportElement x="0" y="20" width="555" height="44" uuid="8c884f7b-76f0-4108-b556-e41c2e594926"/> <imageExpression><![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes()))]]></imageExpression> </image> <textField> <reportElement x="347" y="0" width="43" height="20" uuid="d727ea06-8c53-46ce-8b92-bfa85d7ec83b"/> <textFieldExpression><![CDATA[$F{unit}]]></textFieldExpression> </textField> <textField> <reportElement x="0" y="0" width="40" height="20" uuid="5e24b73b-257a-4b30-8479-2f10e0848d1d"/> <textFieldExpression><![CDATA[$F{id}]]></textFieldExpression> </textField> <textField> <reportElement x="40" y="0" width="207" height="20" uuid="8e21fdc1-63ec-4e21-a37a-62958805a5c5"/> <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression> </textField> <textField> <reportElement x="247" y="0" width="100" height="20" uuid="5cbcee7b-d24b-493b-a88c-a193fc1c2d3c"/> <textFieldExpression><![CDATA[$F{amount}]]></textFieldExpression> </textField> <textField> <reportElement x="390" y="0" width="67" height="20" uuid="84bfd460-2fed-4079-b778-4b3ce43d5184"/> <textFieldExpression><![CDATA[$F{price}]]></textFieldExpression> </textField> <textField> <reportElement x="457" y="0" width="98" height="20" uuid="358c6394-40ba-4a57-b8f9-612d6748641a"/> <textFieldExpression><![CDATA[$F{totalprice}]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] <xmldata> <angebot> <id>aaaaa11111</id> <name>Name of angebot</name> <date>Januar 20,2020</date> </angebot> <customer> <id>287462876</id> <name>Familie Mustermann</name> <street>Musterstr. 1</street> <zipcode>80111</zipcode> <city>Musterstadt</city> </customer> <firmen> <info>Firmenliste</info> <firm> <name>Firma A</name> </firm> <firm> <name>Firma B</name> </firm> <firm> <name>Firma C</name> </firm> </firmen> <group> <id>1</id> <name>Vorbereitende Arbeiten</name> <group> <id>1</id> <name>Baustelleneinrichtung</name> <position> <id>1</id> <name>Baustellen WC</name> <amount>3.00</amount> <unit>Stück</unit> <price>1000</price> <totalprice>3000.00</totalprice> </position> <position> <id>2</id> <name>Baucontainer</name> <amount>2.00</amount> <unit>Stück</unit> <price>100</price> <totalprice>200.00</totalprice> </position> <totalprice>3200.00</totalprice> </group> </group> <group> <id>2</id> <name>Innenausbau</name> <group> <id>1</id> <name>Fliesen- und Natursteinarbeiten</name> <position> <id>1</id> <name>Anschleifen</name> <amount>300.00</amount> <unit>m2</unit> <price>3</price> <totalprice>900.00</totalprice> </position> <position> <id>2</id> <name>Abklopfen</name> <amount>200.00</amount> <unit>m2</unit> <price>10</price> <totalprice>2000.00</totalprice> </position> <totalprice>2900.00</totalprice> </group> <group> <id>2</id> <name>Sonstiges</name> <position> <id>1</id> <name>Matte</name> <amount>30.00</amount> <unit>Stück</unit> <price>1</price> <totalprice>30.00</totalprice> </position> <position> <id>2</id> <name>Streichen</name> <amount>2000.00</amount> <unit>m2</unit> <price>10</price> <totalprice>20000.00</totalprice> </position> <totalprice>20030.00</totalprice> </group> </group> <group> <id>3</id> <name>Unbekannte Arbeiten</name> </group></xmldata>[/code]Need Help !Thanks Link to comment Share on other sites More sharing options...
bikerpfanne Posted August 5, 2019 Author Share Posted August 5, 2019 OK some bad news :( I just want to show , that XML Data, and xPath selects does not have any meaning here I tried to defined following Data Source Expression ... in reportGroup new net.sf.jasperreports.engine.JREmptyDataSource() instead of ((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/group/position")Error is the same : 01:52:47.704 [http-nio-8080-exec-8] ERROR net.sf.jasperreports.engine.fill.JRFillSubreport - Fill 1: exceptionnet.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: new net.sf.jasperreports.engine.JREmptyDataSource() at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:284) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:316) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:672) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:640) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1169) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:522) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:350) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:548) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2583) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:813) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615) at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:433) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:818) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61) at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221) 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: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JREmptyDataSource at reportGroup_1565043926314_683208.evaluate(reportGroup_1565043926314_683208:218) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:302) ... 19 common frames omitted Link to comment Share on other sites More sharing options...
bikerpfanne Posted August 6, 2019 Author Share Posted August 6, 2019 looks like Error in jasper file or not ? Whay same Jasper-File (I copy jasper files to webapp, and do not compile it in javaapp.. I tried to do that, without success) set works in iReport and Jasper Studio and does not work in JavaApp with Jasper Libs ??? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now