在java中没有得到这样的方法错误 [英] getting no such method error in java
问题描述
我收到以下错误,如下所示
I am getting the following error as shown below
java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFSheet.addMergedRegion(Lorg/apache/poi/hssf/util/Region;)I
at net.sf.jasperreports.engine.export.JRXlsExporter.createMergeRegion(JRXlsExporter.java:440)
at net.sf.jasperreports.engine.export.JRXlsExporter.initCreateCell(JRXlsExporter.java:419)
at net.sf.jasperreports.engine.export.JRXlsExporter.createTextCell(JRXlsExporter.java:381)
at net.sf.jasperreports.engine.export.JRXlsExporter.exportText(JRXlsExporter.java:314)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportPage(JRXlsAbstractExporter.java:381)
我正在使用下面的poi jars,如课程路径中所示,并且也使用jasperreports 1.2.5 jar,请告知我已将poi jars从2.5升级到3,所以请告知我是否还需要升级jasperreports-1.2.5.jar与最新的poi jars保持同步
i am using the below poi jars as shown in the class path and also jasperreports 1.2.5 jar please advise i have upgraded poi jars from 2.5 to 3 so please advise do i need to upgrade jasperreports-1.2.5.jar also to be in synch with the latest poi jars
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-3.5-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-contrib-3.5-final.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-scratchpad-3.5-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-ooxml-3.5-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-ooxml-schemas-3.6.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/xmlbeans-2.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/poi-ooxml-schemas-3.10-FINAL.jar"/>
<classpathentry exported="true" kind="lib" path="thirdparty/POI-3.5/jsr173_1.0_api.jar"/>
尽管我做了一些分析,发现此网址为http://community.jaspersoft.com/questions/531433/save-excel-jasperviewer
这表明随着poi的渐变,我也应该升级碧玉罐子
although i have done some analysis and found this url http://community.jaspersoft.com/questions/531433/save-excel-jasperviewer
which suggest with poi up gradation i should upgrade my jasper jars also
对于jasper报表,我还没有升级,我正在使用jasper报表1.2.5 jar,我也应该升级吗,伙计,请告知
for jasper reports i have not upgraded i am using jasper reports 1.2.5 jar should i upgrade that also , folks please advise
推荐答案
java.lang.NoSuchMethodError
是未使用正确版本的库时的典型错误.
java.lang.NoSuchMethodError
is typical error when not using correct version of libraries.
Jasper报表使用多个库,这些库可在其发行版(位于文件夹lib
中)中找到,它们都应包含在classpath
Jasper report uses multiple libraries which can be found in its distribution (in folder lib
), they should all be included in classpath
If you are using Jasper reports 1.2.5 this is its release Jasper report v 1.2.5. You will find correct libraries to include in your classpath
in folder lib
.
但是,毫无疑问最好升级到最新版本(发布此答案6.2.0时),特别是如果您需要导出到xlxs
,ooxml
,XSSF
,则将其在1.2.5中不受支持.
However there is no doubt that is better to upgrade to latest version (when posted this answer 6.2.0), specially if you need to export to xlxs
, ooxml
, XSSF
, this it not supported in 1.2.5.
注意:碧玉报告已更改,文件格式定义从较新版本的DTD
更改为XSD
模式,因此您可能需要在.jrxml中更改标头(或使用旧的.jrxml编译器)
Note: jasper report has change is file format definition from DTD
to XSD
schema in newer version so you may need to change your headers in .jrxml (or use old .jrxml compiler)
这篇关于在java中没有得到这样的方法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!