We noticed that using Aspose Slides 22.8, sometimes an error appear when setting our license.
It’s a weird issue, because when restarting our tomcat server, and the service consequently, the error is gone, and our service works perfectly.
This occur from time to time, and I found another topic with the same issue but it wasn’t resolved. (253294).
A part of our code:
public final static boolean loadLicense(){
Class<?>[] items = new Class<?>[]{
com.aspose.words.License.class
,com.aspose.imaging.License.class
,com.aspose.pdf.License.class
,com.aspose.slides.License.class
,com.aspose.cad.License.class
,com.aspose.barcode.License.class
,com.aspose.psd.License.class
,com.aspose.cells.License.class
,com.aspose.omr.License.class
};
ArrayList<Class<?>> list = new ArrayList<Class<?>>();
list.addAll(Arrays.asList(items));
try{
Class<?> clazz;
InputStream licFile = getLicense(); //our license
if(licFile != null){
for(Class<?> actual : list){
clazz = Class.forName(actual.getName());
Constructor<?> constructor = clazz.getConstructor();
Object instance = constructor.newInstance();
Method optimize = clazz.getDeclaredMethod("setLicense", InputStream.class);
optimize.invoke(instance, licFile);
licFile.reset();
}
}
}
}}
StackTrace:
Caused by: java.lang.NullPointerException
at com.aspose.slides.internal.oh.return.for(Unknown Source)
at com.aspose.slides.internal.oh.return.do(Unknown Source)
at com.aspose.slides.License.setLicense(Unknown Source)"
Our System Structure:
Sistema Operacional - Ubuntu Server
Release: 22.04.3 LTS
Tomcat: 9
openjdk version “1.8.0_352”
OpenJDK Runtime Environment (Temurin)(build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.352-b08, mixed mode)
This bug was fixed in a new Aspose Slides version?
(We have Aspose Total License, and we don’t have any issue setting the license for the other modules, like Pdf, word, barcode and so on. Just in the Slides one).