We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

java.lang.ClassCastException: com.aspose.cells.zaes cannot be cast to com.aspose.cells.zaev

Hi,

Using Aspose Cells for Java, version 21.4.

On one of the on-premise installations of our product, we’ve observed the following exception:

Caused by: java.lang.ClassCastException: com.aspose.cells.zaes cannot be cast to com.aspose.cells.zaev
	at com.aspose.cells.zaes.a(Unknown Source)
	at com.aspose.cells.zaes.a(Unknown Source)
	at com.aspose.cells.Cell.t(Unknown Source)
	at com.aspose.cells.Cell.getFormula(Unknown Source)
	at com.aspose.cells.zakp.a(Unknown Source)
	at com.aspose.cells.zakp.b(Unknown Source)
	at com.aspose.cells.zakp.a(Unknown Source)
	at com.aspose.cells.zakf.a(Unknown Source)
	at com.aspose.cells.zakf.c(Unknown Source)
	at com.aspose.cells.zakf.a(Unknown Source)
	at com.aspose.cells.zakh.b(Unknown Source)
	at com.aspose.cells.zakd.a(Unknown Source)
	at com.aspose.cells.zaki.b(Unknown Source)
	at com.aspose.cells.zaki.a(Unknown Source)
	at com.aspose.cells.Workbook.a(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.company.product.SomeClass.saveWorkbookInternal(<our code>)

Unfortunately, we do not have a file to reproduce this at the moment.

However, perhaps based on the (unscrambled) stack trace, you will be able to determine what the potential issue might be, and if it is resolved in newer versions of Aspose Cells.

Thanks in advance,
Taras

@TarasTielkes,
First you may try the latest version and check if the issue is resolved or not. If not, I am afraid that without the sample file and runnable console application it is not possible to provide assistance based on the stack trace. You may try to manage a sample file for sharing with us as it will help us to observe the issue here and provide feedback accordingly.

@TarasTielkes,
And according to the stack trace, the issue is about formulas, especially for shared formulas or array formulas. However, without the template file to reproduce the issue, we cannot figure our what’s the root cause of this exception, maybe there are some invalid formulas in the file or Workbook.

Hi @johnson.shi,

I was able to reproduce the issue using Aspose Cells for Java, version 21.7.3.

Sample code:

LoadOptions loadOptions = new LoadOptions();
loadOptions.setLightCellsDataHandler(new MyLightCellsDataHandler());
Workbook workbook = new Workbook("input.xlsb", loadOptions);
HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
workbook.save("output.html", saveOptions);

class MyLightCellsDataHandler implements LightCellsDataHandler {

    @Override
    public boolean startSheet(Worksheet sheet) {
        return sheet.getIndex() == 0;
    }

    @Override
    public boolean startRow(int rowIndex) {
        return true;
    }

    @Override
    public boolean processRow(Row row) {
        return true;
    }

    @Override
    public boolean startCell(int columnIndex) {
        return true;
    }

    @Override
    public boolean processCell(Cell cell) {
        return true;
    }
}

Exception thrown:

Exception in thread "main" java.lang.ClassCastException: com.aspose.cells.zaeu cannot be cast to com.aspose.cells.zaex
	at com.aspose.cells.zaeu.a(Unknown Source)
	at com.aspose.cells.zaeu.a(Unknown Source)
	at com.aspose.cells.Cell.u(Unknown Source)
	at com.aspose.cells.Cell.getFormula(Unknown Source)
	at com.aspose.cells.zakr.a(Unknown Source)
	at com.aspose.cells.zakr.b(Unknown Source)
	at com.aspose.cells.zakr.a(Unknown Source)
	at com.aspose.cells.zakh.a(Unknown Source)
	at com.aspose.cells.zakh.c(Unknown Source)
	at com.aspose.cells.zakh.a(Unknown Source)
	at com.aspose.cells.zakj.b(Unknown Source)
	at com.aspose.cells.zakj.a(Unknown Source)
	at com.aspose.cells.zakk.b(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.company.MyCode.main(MyCode.java:22)

Input file: input.zip (15.1 KB)

Kind regards,
Taras

@TarasTielkes,

Please notice, I am able to reproduce the issue as you mentioned by using your template file. I found an exception “java.lang.ClassCastException: com.aspose.cells.zaeu cannot be cast to com.aspose.cells.zaex” on saving to HTML file format. I have logged a ticket with an id “CELLSJAVA-43565” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@TarasTielkes,
Please try our latest fix:
aspose-cells-21.7.6-java.zip (7.4 MB)

By the way, if you needs to load only one specific sheet and kept all cells data of it, LoadFilter is more convenient and it will give better performance too when comparing with LightCells.

Hi @johnson.shi,

Version 21.7.6 does indeed seem to resolve the problem observed.
In out case, we are using the LightCells API to also perform additional filtering of the loaded content. We are aware of the LoadFilter API, and use it in other cases - thanks for the advise though!

Kind regards,
Taras

@TarasTielkes,

Good to know that your issue is resolved by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-43565) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi