Could not initialize class error while using Aspose.Cells and Aspose.Slides

Another thing besides, we are also implement the conversion from excel and ppt by using aspose.total. Currently, we got this error Could not initialize class com.aspose.slides.internal.nn.do, Could not initialize class com.aspose.cells.internal.nn.do, the version using is 22.9, we also tested other versions, but always the same, we are using JDK1.8.0_291

@FSUPTC

We have moved your inquiry in Aspose.Total Forum where you will be assisted accordingly.

@FSUPTC,
We need more details on the issue you encountered. Please share the following additional data and information:

  • input files
  • code examples or sample projects that reproduce the error
  • full stack trace of the errors
  • OS version on which the code was executed

But first, please check the issue with an empty project. It looks like the issue is related to your app configuration.

We are facing this error when converting from excel, ppt, pdf to html.

Here is the OS info:

Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 24.81GiB
Name: docker-desktop
openjdk version “11.0.16.1” 2022-08-12 LTS
OpenJDK Runtime Environment Corretto-11.0.16.9.1 (build 11.0.16.1+9-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.16.9.1 (build 11.0.16.1+9-LTS, mixed mode)

@FSUPTC,
To investigate the case you encountered and help you properly, we need to reproduce the error on our end. Please share the rest of the data and information mentioned above.

Any input files will get the same error.
we are using aspose.cells for java 22.11, aspose.sildes for java 22.9, aspose.pdf for java 22.9.
here is code snapshot:
Excel

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
// Set the Presenation preference option
htmlSaveOptions.setPresentationPreference(true);
htmlSaveOptions.setAddTooltipText(true);
htmlSaveOptions.setExcludeUnusedStyles(true);
htmlSaveOptions.setExportPrintAreaOnly(false);
htmlSaveOptions.setExportComments(true);
htmlSaveOptions.setExpImageToTempDir(true);
htmlSaveOptions.setExportGridLines(true);
htmlSaveOptions.setShowAllSheets(true);
htmlSaveOptions.setExportDocumentProperties(true);
htmlSaveOptions.setExportWorkbookProperties(true);
htmlSaveOptions.setExportWorksheetProperties(true);
htmlSaveOptions.setAttachedFilesDirectory(imagePath);
ByteArrayOutputStream stream = new ByteArrayOutputStream()
try {
Workbook workbook = new Workbook(fileNameWithPath);
workbook.save(stream, htmlSaveOptions); }
} catch (Exception e) {
return e.toString();
}

PPT

HtmlOptions htmlOptions = new HtmlOptions();
// Set the Presentation preference option htmlOptions.getNotesCommentsLayouting().setNotesPosition(NotesPositions.BottomFull);
htmlOptions.setHtmlFormatter(HtmlFormatter.createDocumentFormatter("", false));
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Presentation presentation = new Presentation(fileName);
try {
presentation.save(stream, SaveFormat.Html);
} catch (Exception e) {
return e.toString();
}

Error:

JavaException: java.lang.Exception: Could not initialize class com.aspose.slides.internal.fs.this.

JavaException: java.lang.Exception: java.lang.reflect.InvocationTargetException.

@FSUPTC,
Unfortunately, I was unable to reproduce the error you encountered. Please share a sample project that reproduces the exception.

@FSUPTC,

I guess based on the thread, your issue is related to the Linux configurations. You may try the solution to figure out your soon.

yum install -y fontconfig
fc-cache --force

This issue should be resolved with the above commands on your end.

1 Like