linlinlin Posted December 6, 2010 Share Posted December 6, 2010 Can someone help me please,I am just using ireport. I need to get a Blob type column data from Oracle table. Why I can not find java.awt.Image class in expression class in ireport? there are some "java.lang.String","ava.lang.Boolean"....total 13. but no " java.awt.Image" Thanks a lot Link to comment Share on other sites More sharing options...
hangman01 Posted December 6, 2010 Share Posted December 6, 2010 You can find some information here: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=131 You change the datatype on the blob's field and the image element to java.io.InputStream. Link to comment Share on other sites More sharing options...
linlinlin Posted December 6, 2010 Author Share Posted December 6, 2010 Thank you hangman01,You mean change datatype of the Blob field? It is blob type now, what datatype it should be? in my ireport,I can not choice the java.io.InputStream in expression class. THere is not that class. How can add it and I can choice it from ireport? Link to comment Share on other sites More sharing options...
linlinlin Posted December 7, 2010 Author Share Posted December 7, 2010 Can anyone help please? Link to comment Share on other sites More sharing options...
hangman01 Posted December 7, 2010 Share Posted December 7, 2010 The field class of the blob is set to java.io.InputStream as is the expression class of the image object. Both of these are available on both the earlier versions of iReport and the latest ones. These can be found in the properties window when the correct object is selected. Link to comment Share on other sites More sharing options...
linlinlin Posted December 7, 2010 Author Share Posted December 7, 2010 hangman01,Thank you for your help. Now I can continue, but get follow error:Compilation running time: 996! Filling report... Locale: English (United States) Time zone: DefaultError filling print... Error evaluating expression : Source text : $F{PICTURE} net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{PICTURE} at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:197) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:574) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:542) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:872) at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:914) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:895) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:260) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:486) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1427) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:729) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:256) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:114) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:911) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:814) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:421) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:251) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:864) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986) Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'oracle.sql.BLOB@1e7ed58' with class 'oracle.sql.BLOB' to class 'oracle.sql.BLOB' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:340) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:632) at report12_1291742968897_49466.evaluate(calculator_report12_1291742968897_49466:289) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:186) ... 19 more Print not filled. Try to use an EmptyDataSource... Could you help me?Thanks a lot Link to comment Share on other sites More sharing options...
hangman01 Posted December 7, 2010 Share Posted December 7, 2010 I think I see the cause of the error, apparently you are using groovy language in the report. I have been using java in my examples and all my reports. Unfortunitely I do not know much about the groovy language. I can tell you that for sure the examples I have given here do work when the report is written using java language. Hopefully someone with better knowledge of groovy can supply the answer to this question. Sorry that I cannot be more help on this part of the error. Link to comment Share on other sites More sharing options...
linlinlin Posted December 7, 2010 Author Share Posted December 7, 2010 Thanks for reply.I don't know when I change language from "java" to "groove" in report properties. Now I change back to "java". still has following error: I attach my screenshot.Compilation exceptions: com.jaspersoft.ireport.designer.compiler.ErrorsCollector@bbade4 net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Cannot cast from BLOB to InputStream value = (java.io.InputStream)(((oracle.sql.BLOB)field_PICTURE.getValue())); //$JR_EXPR_ID=9$ <----------------------------------------------------------------> 2. Cannot cast from BLOB to InputStream value = (java.io.InputStream)(((oracle.sql.BLOB)field_PICTURE.getOldValue())); //$JR_EXPR_ID=9$ <-------------------------------------------------------------------> 3. Cannot cast from BLOB to InputStream value = (java.io.InputStream)(((oracle.sql.BLOB)field_PICTURE.getValue())); //$JR_EXPR_ID=9$ <----------------------------------------------------------------> 3 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:195) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:500) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)Post Edited by linlinlin at 12/07/2010 21:24 Link to comment Share on other sites More sharing options...
hangman01 Posted December 7, 2010 Share Posted December 7, 2010 are you selecting the blob from an Oracle database? In my reports I select the blob which is stored in a field such as PICTURE. It is on this field that change the datatype from blob to java.io.InputStream then continue as stated before. You seem to be using a java getValue() method to try to insert the blob and I really have never tried to use this structure in my reports. I will be interested to find out the answer to this problem too. Good luck. Link to comment Share on other sites More sharing options...
linlinlin Posted December 7, 2010 Author Share Posted December 7, 2010 I follow your step, first change datatype from blob to java.io.InputStream. now get another error: java.lang.OutOfMemoryError: Java heap space null looks like it will works .Thanks for help. All the best 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