编译 JasperReports 模板时出现 "The type java.lang.CharSequence cannot be resolved" 错误

Got "The type java.lang.CharSequence cannot be resolved" error when compile JasperReports template

我使用 Netbeans 8.1 和 iReport 5.5.0 插件。我在报告字段中进行了更改。

$F{SASI_NO}.contains("-E")?$F{SASI_NO}.split("-")[0]:$F{SASI_NO}

在我的本地运行良好。但是我将它部署在服务器中。它不起作用,错误如下所示。

javax.servlet.ServletException: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files value = ((java.lang.String)field_SASI_NO.getValue()).contains("-E")?((java.lang.String)field_SASI_NO.getValue()).split("-")[0]:((java.lang.String)field_SASI_NO.getValue()); //$JR_EXPR_ID=31$

有人帮忙吗?

我找到了解决办法。我的 windows 服务器的 Java 版本是 1.8.0.121。我将 Java 降级到 1.7 版本。


此处描述的问题:JRXML not compiling in Java 8

JasperReports 库的这个错误已在 6.0 版本

中修复