Aspose cell exception:om.ctc.wstx.sr.ValidatingStreamReader cannot be cast to com.ctc.wstx.sr.ValidatingStreamReader

早过忘川 提交于 2019-12-11 02:14:30

问题


I am using Aspose.Cells (trial version) to parse a .xls (Excel) file for Java. But when I try to load the file, it throws the exception given below:

SEVERE: java.lang.IllegalStateException: XML Stream Exception: XMLStreamException: com.ctc.wstx.sr.ValidatingStreamReader cannot be cast to com.ctc.wstx.sr.ValidatingStreamReader

Here is my code

Workbook workbook = new Workbook();
try {
  workbook.open(path+fileName);
} catch (Exception e) {
  e.printStackTrace();
}
Worksheet worksheet = workbook.getWorksheets().get(0);

This exception is coming at workbook.open(path+fileName); this line.I am quiet sure that this is not due to wrong path because when I give wrong path then aspose throws FileNotFoundException.So now I am stuck here and unable to find why this is happening?

Note: In search of this problem, I found this answer on aspose forum but it is not helpful and feasible(to check all the classes present in jars placed in lib).


回答1:


We recommend you to kindly try our latest version of the product (e.g v7.7.x (JAVA)) as we did remove some inter dependencies jars and have written/included our own custom XML parsers to perform some XML operations in the product. In the new versions, we we have removed the conflicting "com.etc.wstx" jar in the product, so you should not find this exception any more.

Thanks,



来源:https://stackoverflow.com/questions/14805975/aspose-cell-exceptionom-ctc-wstx-sr-validatingstreamreader-cannot-be-cast-to-co

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!