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

Free Support Forum - aspose.com

com.aspose.slides.AsposeLicenseException: Couldn't parse black list

Hello

We are experiencing a problem with the Java version of Aspose slides.
com.aspose.slides.AsposeLicenseException: Couldn’t parse black list. Please report this error to Aspose.
at com.aspose.slides.LicenseController.try(Unknown Source)
at com.aspose.slides.LicenseController.if(Unknown Source)
at com.aspose.slides.LicenseController.setLicense(Unknown Source)
at com.aspose.slides.License.setLicense(Unknown Source)

The error occures in this piece of code:
InputStream is = GeneralDocumentSlidesHandler.class.getClassLoader().getResourceAsStream(“com/gent/aspose/Aspose.Total.Java.lic”);
com.aspose.slides.License license = new com.aspose.slides.License();
license.setLicense(is); <<< this line

Machine details: Windows Server 2008 R2 Standard - 64bit
The program should run in a JBoss environment (JBoss 4.3.0). We’ve already tried different versions of Java JRE (1.6 / 1.7) on this machine but we keep getting the same error.

Hi Peter,

Thank you for considering Aspose.

For investigation of your issue, please send us your license file by following the steps mentioned in the below link. We will check your license file and will get back to you soon.

http://www.aspose.com/corporate/purchase/faqs/send-license-to-aspose-staff.aspx

Thanks & Regards,

Hi Peter,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the license file via email.

I have tested your issue using your license file on a Windows 7 x64 machine with JDK 1.7.0_21 and I am unable to find any issue. The license is applying fine. We will further test the issue on Windows 8 x64 environment and share the results with you. Also, please confirm if you can set the license by using file path as parameter of setLicense method instead of stream as mentioned below.

com.aspose.slides.License license = new com.aspose.slides.License();

license.setLicense("C:\\Data\\License_Test\\Aspose.Total.Java.lic");

Thanks & Regards,

Thank you for your reply.
We’ve tried to extract the license file first from the jar file to a temporary location.
After that we used the setLicense(“path to license”) method instead of the inputstream

However, we are getting the same error. Strangely enough, the second time we try to run this piece of code in the same session of the application it runs fine. If I quit my application and try again I’m getting the exception again.

Hi Peter,

We are sorry for the delayed response. I like to share that we had encountered the similar issue while accessing the license in OSGI application. The issue was observed in java.lang.Thread.currentThread().getContextClassLoader() which returns ‘null’ if called within an OSGi bundle. Please try using following sample in your application and share with us if there is still an issue. Please make necessary changes in the sample code to serve your purpose.

public String getLicense() {
String returnMessage;
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try (InputStream licStream = GeneralDocumentSlidesHandler.class.getResourceAsStream("/licenses/Aspose.Total.Java.lic")) {
com.aspose.slides.License pptLicense = new com.aspose.slides.License();
pptLicense.setLicense(licStream);
returnMessage = “License loaded OK”;
} catch (AsposeLicenseException | IOException x) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter, true);
x.printStackTrace(printWriter);
returnMessage = "Error loading license file: " + stringWriter.getBuffer().toString();
}
} finally {
Thread.currentThread().setContextClassLoader(tccl);
}
return returnMessage;
}

Many Thanks,