Joe Taras Posted May 21, 2019 Share Posted May 21, 2019 I'm using JasperSoft Studio 6.8.0 and I've a struggling error:I've a `logo` property of my Java class `EnvParameter`.this property is a `byte[]`I pass my Java class to Jasper Studio, so I try to load the image inside logo property as follow: net.sf.jasperreports.engine.util.JRImageLoader.loadAwtImageFromBytes($P{EnvParameter}.logo)But I have this error:> net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error> evaluating expression for source text:> net.sf.jasperreports.engine.util.JRImageLoader.loadAwtImageFromBytes($P{EnvParameter}.logo)> at> net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:284)> at> net.sf.jasperreports.compilers.GroovyEvaluator.handleEvaluationException(GroovyEvaluator.java:98)> 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.JRFillImage.evaluateImage(JRFillImage.java:466)> at> net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:440)> 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.fillTitle(JRVerticalFiller.java:323)> at> net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:150)> at> net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)> at> net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:414)> at> net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:814)> 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:> groovy.lang.MissingMethodException: No signature of method: static> net.sf.jasperreports.engine.util.JRImageLoader.loadAwtImageFromBytes()> is applicable for argument types: ([b) values: [[-119, 80, 78, 71, 13,> 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, ...]] Possible solutions:> loadAwtImageFromBytes([b) at> groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1518)> at> groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1504)> at> org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:52)> at> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)> at> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)> at> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)> at> rptVTitolo_1558437271760_434544.evaluate(calculator_rptVTitolo_1558437271760_434544:203)> at> net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:302)> ... 17 common frames omitted mag 21, 2019 1:17:36 PM> org.apache.catalina.core.StandardWrapperValve invoke Link to comment Share on other sites More sharing options...
C-Box Posted May 21, 2019 Share Posted May 21, 2019 Hi,is the parameter really passed for the fill process and also not null?perhaps it's better to use a (common) public getter instead direct access to that field "logo" in your parameter-class "Env-Parameter"? So that you could use $P{EnvParameter}.getLogo() as ImageExpression?Otherwise you could also change the report-language from Groovy to Java... just to see, if the compile process already has problems with your expression.hth + regardsC-Box Link to comment Share on other sites More sharing options...
Joe Taras Posted May 21, 2019 Author Share Posted May 21, 2019 Dear, I've tried with getLogo() too but the error is the same.Now I try to change language to Java (but it's very expensive because I must to change other groovy expressions in the report) Link to comment Share on other sites More sharing options...
Joe Taras Posted May 21, 2019 Author Share Posted May 21, 2019 Dear, I've tried to change my language from groovy to Java but I have a lot of errors as follow:net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:1. Only a type can be imported. it.uncertainty.dmn.EnvParameter resolves to a packageimport it.uncertainty.dmn.EnvParameter;all for all occurencies of EnvParameter I used in my report My head bursts! Link to comment Share on other sites More sharing options...
C-Box Posted May 22, 2019 Share Posted May 22, 2019 Hmm, seems that your import is wrong... try to use it as a package Import instead:import it.uncertainty.dmn.EnvParameter.*;hthC-Box Link to comment Share on other sites More sharing options...
Joe Taras Posted May 22, 2019 Author Share Posted May 22, 2019 The same error with Java language selected ;( Link to comment Share on other sites More sharing options...
C-Box Posted May 22, 2019 Share Posted May 22, 2019 How is the package-Structure of our class " EnvParameter"? Is ita) it.uncertainty.dmn.EnvParameter (so that the full resolved class name incl. package would be: it.uncertainty.dmn.EnvParameter.EnvParameter)or justb) it.uncertainty.dmn (so that the full resolved class name incl. package would be: it.uncertainty.dmn.EnvParameter )??? The compile error message would tell me, that your given import resolved is directing to a package and not to the concrete class... !??!regardsC-Box Link to comment Share on other sites More sharing options...
Solution Joe Taras Posted May 24, 2019 Author Solution Share Posted May 24, 2019 I've done, I don't believe!!!In Image element I've simple put ${EnvParameter}.getLogo() without call the function about load image. Thank you for your support @C-Box 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