I’ve been getting many ‘java.lang.NoSuchMethodError’ errors, such as when using Cells to save worksheet as pdf:
java.lang.NoSuchMethodError com.aspose.a.c.a.a(Lcom/aspose/cells/Chart;)Z
at com.aspose.cells.Chart.toImage(Unknown Source)
etc…
After a little bit of looking, I realized that both the
PdfKit jar and the Cells jar are using obfuscated classes with the same
package/class names, like 'com.aspose.a.a.c’
All of the other Aspose products only include obfuscated classes within their own package, like 'com.aspose.words.*'
So,
I think the problem is that when the Chart.toImage() method is trying
to use the class com.aspose.a.c.a, it’s actually getting the class from
the PdfKit jar.
So, everything works fine if your project uses only one of the two jars,
but if you are using both jars, I’m not sure how to determine or
control which class from which jar is used. I think the only solution
would be for either Cells or PdfKit to re-package the jar file with
classes in unique package names.
I’ve posted this to the Cells forum as well.
John Phillips
Hi John,
Please share a complete working sample along with the sample files which can help us reproduce the same issue at our end. So, we could understand your scenario and fix the issue accordingly.
We’re sorry for the inconvenience and looking forward to help you out.
Regards,
The Aspose Cells team rebuilt their jar, version 2.4.0.6, moving all their jar classes within the com.aspose.cell package. That took care of the issue. I would recommend, however, that the PdfKit jar be similarly restructured, to avoid these class name conflicts in the future.
John Phillips
Hi John,
Thank you very much for the suggestion. I have logged this recommendation as PDFKITJAVA-20101 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.
If you find any further questions or concerns, please do let us know.
Regards,