NoClassDefFoundError Is Thrown while Processing PPTX > 10MB

We are observing the below error while aspose is trying to process pptx file greater than 10MB

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

The above issue is not observed in local but, seeing it in the DEV environments

Version details
Aspose.slide: 22.4, jdk16
Java Verdion: jdk17

Any help in this will be appreciated

Thanks

@abhi2710,
Thank you for contacting support.

We need more details to investigate this case. Please share the following data and information:

  • presentation file (you can zip the file and upload it here)
  • code example that reproduces the error
  • OS version where the code was executed
  • maximum amount of memory for JVM you used

Hi Andrey,

I am replying on behalf of @abhi2710

Below are the requested details for further investigation

@sirishasajja,
Thank you for the additional information. We will reply to you as soon as possible.

@sirishasajja,
Could you please also share a full stack trace of the error?

@Andrey_Potapov
I have attached the full stack trace of the error . The issue is related to jdk-17 , we are using the below version for aspose.slides

name: ‘aspose-slides’, version: ‘22.4’, classifier: ‘jdk16’

Error: java.lang.UnsatisfiedLinkError: /usr/java/openjdk-17/lib/libfontmanager.so

pptxfile_stacktrace.zip (1.6 KB)

@sirishasajja,
I added a ticket with ID SLIDESJAVA-38788 to our issue tracking system. Our development team will investigate this case. We will inform you of any progress.

@sirishasajja,
Our development team investigated the issue. It looks like you have a problem with Linux because this exception means that libfreetype.so.6 cannot be found. Please try installing libfreetype6 like this:
apt-get install libfreetype6
or
yum install libfreetype6

Also, after installing libfreetype6, additional packages may be required (use apt-get install or yum install):

  1. fontconfig
  2. fonts-dejavu or dejavu-sans-fonts

@Andrey_Potapov,

Thank you for the update , we will work on installing ilbfreetype6 on our Linux machines.

Meanwhile can you please provide the list of all packages required by Aspose on the Linux machines so that we will make sure that we have everything installed.

@sirishasajja,
Aspose.Slides does not require additional packages. As you can see in the stack trace log, the error was caused by the JDK. The JDK use many system libraries.

Documents: Aspose.Slides Installation

@Andrey_Potapov ,
We have installed the necessary packages on Linux machines to resolve the jdk issue that we have faced, now we are seeing a NoClassDefFoundError which is more specific to Aspose while processing the same pptx files . I have attached the stack trace for refernce.

Error : java.lang.NoClassDefFoundError: Could not initialize class com.aspose.slides.internal.fs.this

Pptx_NoClassDefFoundError.zip (1.2 KB)

@sirishasajja,
I have not managed to reproduce any exceptions using the presentation file you provided earlier. Could you please specify Linux distribution where the error occurs?

@Andrey_Potapov
Below is the Linux distribution that we are using and these are the k8s pods running with base RHEL image & open jdk17:

Linux il-page-count-7767bb9474-q6kj9 4.4.0-201-generic #233-Ubuntu SMP Thu Jan 14 06:10:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

@sirishasajja,
Thank you for the additional information. I’ve passed it on to our developers.

@sirishasajja,
Our developers reported that the issue is related to accessing fonts. Aspose.Slides is using the following folders to find fonts in Linux:

  • /usr/share/fonts
  • System.getProperty(“user.home”) + “.fonts”
  • /usr/local/share/fonts
  • /usr/X11R6/lib/X11/fonts

Please check the access of Java process to font folders.

@Andrey_Potapov,
We do have the the below font directory existing on our pods but we are still seeing the same issue while uploading the pptx files.

Fonts Directory :
[root@Test-7767bb9474-q6kj9 fonts]# ls -lrth
total 12K
drwxr-xr-x 2 root root 314 Apr 29 14:18 dejavu
drwxr-xr-x 2 root root 8.0K Apr 29 14:19 urw-base35
drwxr-xr-x 2 root root 167 Apr 29 14:20 fontawesome
[root@Test-7767bb9474-q6kj9 fonts]# pwd
/usr/share/fonts

@sirishasajja,
Have you tried reading some font data from your font folders in your app?

@Andrey_Potapov,

Yes , we have tried reading fonts from our font folders and seeing the same error.

@sirishasajja,
Could you please clarify how you tried reading fonts from your font folders?

@Andrey_Potapov,
sorry for the confusion , we are not reading any external fonts while processing the pptx files. we are applying external fonts for word and xls files .

I am trying to read the external fonts using FontsLoader.loadExternalFonts for pptx files as well , I will update if I see any change in the behavior.