Aspose.Total for Java Failed to set license. Details: Failed to check license

Dear Aspose support team,

We have a 30 days temporary license until we are waiting for our full license to be issued even though all the payments have been made.
When we try to start the applications, which are using Aspose total version 21.6, with the temporary license, we get the following exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'asposeConfig': Invocation of init method failed; nested exception is java.lang.Exception: Failed to set license. Details: Failed to check license.
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:895)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
   
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.Exception: Failed to set license. Details: Failed to check license.
        at com.aspose.barcode.License.setLicense(Unknown Source)
       
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157)
        ... 24 common frames omitted

This is urgent as it’ll affect our production environment from tomorrow.

Could you please provide a solution ASAP?

Thanks & Regards,
Madhurendra Narayan Tiwary

@edleads

It seems you are encountering an issue with setting the temporary license for Aspose.Total for Java. Here are some steps to troubleshoot and resolve the problem:

  1. Check License File: Ensure that the license file is correctly placed in the same directory as your application’s JAR files or provide the correct path to the license file in your code.

  2. Correct License Class: Make sure you are using the correct License class for the specific Aspose product you are working with. For example, if you are using Aspose.PDF, you should use com.aspose.pdf.License.

  3. Code Example: Here’s a sample code snippet to set the license:

    // Initialize License Instance
    com.aspose.pdf.License license = new com.aspose.pdf.License();
    // Set license from file
    license.setLicense("Aspose.Total.Java.lic");
    
  4. Validate License: After setting the license, you can check if it has been applied correctly:

    if (com.aspose.pdf.Document.isLicensed()) {
        System.out.println("License is set!");
    } else {
        System.out.println("License is not set.");
    }
    
  5. File Integrity: Ensure that the license file has not been modified or corrupted. Even a small change can invalidate the license.

  6. Contact Support: If the issue persists, consider reaching out to Aspose support for further assistance, especially since this is affecting your production environment.

By following these steps, you should be able to resolve the licensing issue.

@edleads,

Thank you for providing the exception trace and details.

It appears that you are using an older version of the Aspose for Java APIs (more than 2-3 years old) and are encountering issue while setting up your temporary license for Aspose.BarCode for Java.

Please note that newer licenses are signed with SHA256, whereas older licenses were signed with SHA1. A SHA256 license cannot be used with older API versions. If you already have an older license, you can continue using it with the older Aspose for Java API versions. Similarly, a newer license must be used with the newer API versions. This compatibility approach will always work.

We recommend upgrading to the latest API versions, as they include numerous fixes and enhancements. However, if you still prefer to continue using the older API versions with new license, you can request an updated Java license signed with SHA1. To do so, you may contact the Sales team through the relevant forum or via email. The updated license will be compatible with both older and newer Aspose for Java API versions.

Please let us know if you need further assistance.