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

Free Support Forum - aspose.com

Could Not Save XLSX/XLS/ODS to PDF in Java 17. (Error: InvocationTargetException)

Hi,

I am using Aspose.total with Developer OEM license.

  • With Aspose cells, I am trying to convert a XLSX / XLS / ODS file to PDF as follows :
 com.aspose.cells.PdfSaveOptions cellsPdfSaveOptions = new com.aspose.cells.PdfSaveOptions();
 Workbook workBook = new Workbook(GZIPInputStreamObject);
 workBook.save(fileOutputStream, cellsPdfSaveOptions);
  • Previously, I am working with [java.version - 1.8.0_231]
    In [Java - 1.8], these XLSX / XLS / ODS to PDF conversion works as expected.
  • I am using the latest version of Aspose cells [22.7]
 <dependency>
 	<groupId>com.aspose</groupId>
 	<artifactId>aspose-cells</artifactId>
 	<version>22.7</version>
 </dependency>
  • To check the performance in updated Java versions, I changed [Java.version - 17]
  • I’ve tested XLSX / XLS / ODS to PDF conversion with Aspose.Cells 22.7 and Java 17, it works fine in local Windows PC.

We are facing this issue only in server.

Redhat Details:
Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
Java 17 : java version "17.0.4.1" 2022-08-18 LTS
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
Kernel: Linux 3.10.0-1160.49.1.el7.x86_64
Architecture: x86-64
  • Now, If I try to convert any XLSX / XLS / ODS file to PDF in server, the last line [workBook.save()] throws the below error :

[ERROR MSG] Handler dispatch failed; nested exception is java.lang.InternalError: java.lang.reflect.InvocationTargetException
[ERROR CAUSE] java.lang.InternalError: java.lang.reflect.InvocationTargetException

Do I need to add any other configuration for later Java versions (JDK-17) ?

@dev.raz,

We have not found such an issue with jdk1.7. We need to look into it to see whether we can trace your issue. We will get back to you soon.

@Amjad_Sahi,

We have not found such an issue with jdk1.7.

We mentioned this issue with Java 17 LTS (JDK 17) not Java 7 (JDK 1.7).

@dev.raz,

Ok, we will evaluate your issue using Java 17 LTS (JDK 17).

@Amjad_Sahi

I have attached below stack trace of the error for your reference.
Cells StackTrace.docx (7.8 KB)
.

@dev.raz

Thanks for the stacktrace.

Please notice, we have logged a ticket with an id “CELLSJAVA-44902” for your issue. We will investigate on if Aspose.Cells has problem when rendering XLSX/XLS/ODS to PDF in Java 17 LTS (JDK 17).

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

@Amjad_Sahi

This issue is also occurs in aspose.slides.
Based on Aspose Slides team suggestion, it is related to the Linux configuration

yum install -y fontconfig
fc-cache --force

This issue has been resolved with the above commands.

@dev.raz,

It looks like after running the configuration commands, your issue is resolved on your end. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.