Problem opening XLSX files

Greetings,

I am evaluating Aspose.Cells for Java and have just downloaded the library and am working on a simple test application which opens an exists XLSX file, makes a modification, and then saves with another file name.

Upon executing the following:

try {
LoadOptions loadOptions = new LoadOptions(FileFormatType.XLSX);
Workbook workbook = new Workbook(“D:\Work\test.xlsx”, loadOptions);

Worksheet worksheet = workbook.getWorksheets().get(0);
Cell cell = worksheet.getCells().get(“A1”);
cell.setValue(“Hiya!!!”);
workbook.save(“D:\Work\test2.xlsx”, FileFormatType.XLSX);
} catch (Exception ex) {
Logger.getLogger(MainBacking.class.getName()).log(Level.SEVERE, null, ex);
}

I receive the following exception upon executing the workbook constructor :

java.lang.ClassCastException: com.ctc.wstx.sr.ValidatingStreamReader cannot be cast to com.ctc.wstx.sr.ValidatingStreamReader
at com.aspose.cells.b.a.h.j.a(Unknown Source)
at com.aspose.cells.b.a.h.j.(Unknown Source)
at com.aspose.cells.b.a.h.j.(Unknown Source)
at com.aspose.cells.kw.a(Unknown Source)
at com.aspose.cells.kw.k(Unknown Source)
at com.aspose.cells.kw.a(Unknown Source)
at com.aspose.cells.kv.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at com.accuvant.testaspose.backing.MainBacking.testAspose(MainBacking.java:32)

I have included all of the jars in the library folder including woodstox-core-asl-4.1.1.jar.

I am running Java 1.6.

Any help would be appreciated.

ko

Hi,

Thank you for evaluating Aspose.Cells. From the stack trace, it seems there are conflicted implementations for "com.ctc.wstx.sr.ValidatingStreamReader". Please check all libraries used by your classpath to confirm there is no other library which contains "com.etc.wstx.**" except "woodstox-core-asl-4.1.1.jar". If you still get this issue, please send us your complete test project(including all jars and settings to run your application) so we can reproduce and trace the issue. If you are running your application in a webserver, please test your code with Aspose.Cells in a console program out of the server environment firstly to check whether it can work.

Thank you.

Hi,


I am also testing Aspose.Cells and having the same problem.

SEVERE: Caused by: java.lang.ClassCastException: com.ctc.wstx.sr.ValidatingStreamReader cannot be cast to com.ctc.wstx.sr.ValidatingStreamReader

I tested aspose.cells with a simple Java program and it worked perfectly, nevertheless my project is quite different.

I call aspose.cell using a servlet that is deployed in a glassfish server and it’s in this context that I am having this problem.
The jars that I have added to my glassfish domain are:
Aspose.Words.jdk16.jar
aspose-cells-7.4.3.jar
bcprov-jdk16-146.jar
dom4j-1.6.1.jar
stax2-api-3.0.2.jar
woodstox-core-asl-4.1.1.jar

I have tried deleting bcprov-jdk16-146.jar but it doesn’t work because it is necessary.

Thanks in advance,

Carlos LOPEZ

Hi Carlos,


Please try our latest version: Aspose.Cells for Java v7.5.1:
we have removed some inter dependencies jars like woodstox, stax2 and other jars from the release and have written/included our own custom xml parser and to perform other xml operations in the product.

Thank you.


Hi Amjad,


Thanks for your quick answer; It works perfectly now =)

You’ve made an excellent job with ASPOSE!!!

Hi,


Good to know that it sorts out your issue now.

Feel free to contact us any time if you have further queries or have some other issue, we will be happy to assist you soon.

Thanks,