我试图添加一个图像到我的jasperReport,但它不工作,它停止时调用:
JasperRunManager.runReportToPdf ....
我在数据库中将图像类型设置为BLOB,并在“file.jrxml”中将其设置为
字段--〉图像文件
字段类--〉Oracle数据库.
和图像属性:
图像表达式-〉$F{图像文件}.getBinaryStream()
表达式类-〉java.lang.String
消息错误:
12:22:24,863 INFO [STDOUT] 12:22:24,862 ERROR [JRFillSubreport] Fill 1: exception
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{IMAGE_FILE}.getBinaryStream()
...
...
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'oracle.sql.BLOB@5d17f1ea' with class 'oracle.sql.BLOB' to class 'oracle.sql.BLOB'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
...
...
12:22:24,863 ERROR [STDERR] net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{IMAGE_FILE}.getBinaryStream()
所以主要错误无法解决,也找不到原因:
12:22:24,868 ERROR [STDERR] Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{IMAGE_FILE}.getBinaryStream()
12:22:24,869 ERROR [STDERR] Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'oracle.sql.BLOB@5d17f1ea' with class 'oracle.sql.BLOB' to class 'oracle.sql.BLOB'
2条答案
按热度按时间jslywgbw1#
我找到了答案。只要修改这两个值,现在就可以了:
和新图像属性:
ekqde3dh2#
现场说明:
图像说明: