Aspose words initialisation error

Hi,
Using the latest aspose words 24.9 on java 1.8. Facing the issue while loading aspose related classes though it works fine for aspose-cells. Getting below error, can you please help

java.lang.ExceptionInInitializerError
	at com.aspose.words.License.<init>(Unknown Source)
	at ji.awt.jiPooledThread.run(jiPooledThread.java:106)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at com.ibm.icu.charset.CharsetHZ$CharsetDecoderHZ.<init>(CharsetHZ.java:49)
	at com.ibm.icu.charset.CharsetHZ.newDecoder(CharsetHZ.java:373)
	at com.aspose.words.internal.zzXVI$1.zzBh(Unknown Source)
	at com.aspose.words.internal.zzXVI$zzS.zzYXu(Unknown Source)
	at com.aspose.words.internal.zzXVI.zzW61(Unknown Source)
	at com.aspose.words.internal.zzXim.zzWtB(Unknown Source)
	at com.aspose.words.internal.zzXim.<init>(Unknown Source)
	at com.aspose.words.internal.zzXim.<init>(Unknown Source)
	at com.aspose.words.internal.zzZdR.<init>(Unknown Source)
	at com.aspose.words.internal.zzXSs.zzS(Unknown Source)
	at com.aspose.words.internal.zzXSs.zzZRw(Unknown Source)
	at com.aspose.words.internal.zzXSs.zzVZQ(Unknown Source)
	at com.aspose.words.internal.zzY2F.<init>(Unknown Source)
	at com.aspose.words.internal.zzXSs.<init>(Unknown Source)
	at com.aspose.words.internal.zzXim.<clinit>(Unknown Source)

@maheibm

It seems you are encountering an ExceptionInInitializerError when trying to load Aspose.Words classes in your Java application. This error often indicates that there is an issue during the initialization of a class, which in your case appears to be related to the License class.

Here are some steps you can take to troubleshoot and resolve this issue:

  1. Check License File: Ensure that the license file (Aspose.Words.lic) is present in the expected location. The license file should be accessible to your application, and you can set it using the setLicense method. Here’s a sample code snippet for setting the license from a file:

    License license = new License();
    try {
        license.setLicense("path/to/Aspose.Words.lic");
        System.out.println("License set successfully.");
    } catch (Exception e) {
        System.out.println("There was an error setting the license: " + e.getMessage());
    }
    
  2. Verify Classpath: Make sure that all required Aspose libraries are included in your classpath. Sometimes, missing dependencies can lead to initialization errors.

  3. Check for Null Values: The stack trace indicates a NullPointerException in the CharsetHZ class. This could be due to a missing or improperly configured dependency. Ensure that all necessary libraries are correctly referenced in your project.

  4. Update Java Version: Although you are using Java 1.8, consider updating to a more recent version if possible, as newer versions may have bug fixes and improvements that could resolve compatibility issues.

  5. Review Documentation: Check the Aspose documentation for any specific requirements or configurations needed for the version you are using. This can provide insights into any additional setup that may be required.

If the issue persists after trying these steps, consider reaching out to the Aspose support team with detailed information about your environment and the steps you’ve taken so far.

Feel free to ask if you need further assistance!

Caused by: java.lang.NullPointerException
at com.ibm.icu.charset.CharsetHZ$CharsetDecoderHZ.(CharsetHZ.java:48)
at com.ibm.icu.charset.CharsetHZ.newDecoder(CharsetHZ.java:372)
at com.aspose.words.internal.zzWtk$1.zzYp8(Unknown Source)
at com.aspose.words.internal.zzWtk$zzZy.zzZC1(Unknown Source)

is called from aspose words internal class, could you please let us know how is it referring to the CharsetHZ class and is there a way to change the same.

@maheibm Could you please provide simple code that will allow us to reproduce the problem on our side? Have you tried using the latest 24.10 version?