Jump to content

gabriel.nadoroski
Go to solution Solved by gabriel.nadoroski,

Recommended Posts

Hi

I have a big problem, I make a report in jasper, in software the report works using a DataMatrix, but wen i put in the file jrxml in php (framework yii2), a have a error, wen I remove the DataMatrix he back to normal operation

This is the code I use to generate the DataMatrix

<image>    <reportElement x="257" y="50" width="50" height="50"                   uuid="0d4a0fa1-0998-457f-8d25-d157bcbc11f4"/>    <imageExpression>        <![CDATA[com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(new com.google.zxing.datamatrix.DataMatrixWriter().encode($F{CodigoDeBarras}, com.google.zxing.BarcodeFormat.DATA_MATRIX,100,100))]]>    </imageExpression></image>[/code]

The error in the framework is the 'file is not a valid jrxml file'.

anyone can help ?

 

Gabriel Nadoroski

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

In the Studio, your expression works fine with dependencies.

Check if you are missing these dependencies in your framework. 

 

    <import value="com.google.zxing.*"/>
    <import value="com.google.zxing.client.j2se.*"/>

<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.4.2.final using JasperReports Library version 6.4.1  --><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="dataMatrix" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3b05d319-6bc1-41cc-9f50-1733cb19849f">    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>    <import value="com.google.zxing.*"/>    <import value="com.google.zxing.client.j2se.*"/>    <queryString>        <![CDATA[]]>    </queryString>    <background>        <band splitType="Stretch"/>    </background>    <title>        <band height="79" splitType="Stretch"/>    </title>    <pageHeader>        <band height="35" splitType="Stretch"/>    </pageHeader>    <columnHeader>        <band height="61" splitType="Stretch"/>    </columnHeader>    <detail>        <band height="210" splitType="Stretch">            <image>                <reportElement x="0" y="0" width="300" height="210" uuid="548ff446-5c8b-4d33-a2ce-9553abfad2fb"/>                <imageExpression><![CDATA[com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(new com.google.zxing.datamatrix.DataMatrixWriter().encode("123456789", com.google.zxing.BarcodeFormat.DATA_MATRIX,100,100))]]></imageExpression>            </image>        </band>    </detail>    <columnFooter>        <band height="45" splitType="Stretch"/>    </columnFooter>    <pageFooter>        <band height="54" splitType="Stretch"/>    </pageFooter>    <summary>        <band height="42" splitType="Stretch"/>    </summary></jasperReport>[/code]

 

Link to comment
Share on other sites

Thanks for the answer, but don't work, I tried put thie import in the file and i tried put the same code you sended, both don't work, he get the same error.
The problem is, I have to do the report with the DATAMATRIX, I tried use the DATAMATRIX of jasper, but have a bug, when I put the field of barcode and select the datamatrix, field show just a bean and stop the software, like a ghost field I can't edit the field, I have reniciate the software to he back to normal work.

You have any Idea to fix that error ? 

Link to comment
Share on other sites

This dependencies I put on jasper ?
I think can't put this on php.

I'm using the jasper 6.6.0,  the jars of another version made missing in this version ?

And about post the jrxml, I need the modify somethings, because I can't post everything ofthe jrxml, somethings is confidential, I will see with my equipe what's I can post here, and I edit this post and put here.
I will try put these jars, thanks.

 

Link to comment
Share on other sites

This is the error when I select the barcode in palette and after select the DataMatrix, when I try to save or change to the source or preview, this error appear.

java.lang.RuntimeException: java.lang.NullPointerException
    at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:304)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.compileJasperDesign(ReportController.java:467)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$8(ReportController.java:452)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:376)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.NullPointerException
    at net.sf.jasperreports.engine.component.ComponentsEnvironment.getManager(ComponentsEnvironment.java:159)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:1639)
    at net.sf.jasperreports.engine.design.JRDesignComponentElement.collectExpressions(JRDesignComponentElement.java:99)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:1618)
    at net.sf.jasperreports.engine.design.JRDesignFrame.collectExpressions(JRDesignFrame.java:95)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:801)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:772)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:755)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:1542)
    at net.sf.jasperreports.engine.JRExpressionCollector.collect(JRExpressionCollector.java:629)
    at net.sf.jasperreports.engine.JRExpressionCollector.collector(JRExpressionCollector.java:119)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:149)
    at net.sf.jasperreports.eclipse.builder.JasperReportCompiler.compileReport(JasperReportCompiler.java:286)
    ... 4 more

Anyone knows how fix that error ?
 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...