Could not initialize class java.awt.SystemColor

Hi Aspose Team,

I’m using Aspose.Word for Java to transform emails (HTML) to PDF. Testing a prototype and running unittests of final components operates well local on Win8. But I run into difficulties deploying same components assembled within a webapp in tomcat on RedHat.

Dependent libs (jai and imageio) are available, I solved an earlier exception (Can’t connect to X11 window server)by setting java.awt.headless to true. Nevertheless I still got following exception creating a Document:

java.lang.NoClassDefFoundError: Could not initialize class java.awt.SystemColor
at asposewobfuscated.zz4C.zzrb(Unknown Source)
[…]
at com.aspose.words.Document.(Unknown Source)

Obviously I still lack any resource. Maybe you can give me a hint?

Thanks in advance!
Enno

Hi Enno,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input documents (in your case, the HTML document).
  • Please

create a standalone/runnable simple Java application that demonstrates the code (Aspose.Words code) you used to generate
your output document

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Hi Tahir,

thanks for quick response.

I attached an example webapp. I could isolate the reason within the HTML source given to AsposeWords. Accordingly the webapp provides links two for testwise transformation of real simple HTML and more complicated HTML that contains styles as used by usual mail clients.

Testing in GlasFish 3.1 and 4.0 on Win8 operates for both, simple and complex HTML content. Running the example in Tomcat 6.0 on Red Hat 4.4 leads to the described exception when trying to transform the complex content.

java.lang.NoClassDefFoundError: Could not initialize class java.awt.SystemColor
asposewobfuscated.zz4C.zzrb(Unknown Source)

Deploying the WAR file and opening http://localhost:8080/AsposeWords you will find a page providing links to test for simple and complex content. You will find the source code within the war file, especially enno.aspose.words.TestServlet which contains the HTML.

I would be really glad if you can give me a hint which resources are necessary to alsways successfully initialize all used components.

Best regards,
Hans

Hi Hans,

Thanks for sharing the detail. I have tested the scenario at Windows 8 (GlasFish 3.1) and Ubuntu (Tomcat) using latest version of Aspose.Words for Java 14.5.0 and have not found the shared issue. Please use the latest version of Aspose.Words for Java 14.5.0.

Hi Tahir,

even it is nearly two weeks old I’ve not been aware of the lastest version. Great, no missing resources reported anymore.

Switching from 14.4 to 14.5 additionally resolved some trouble formatting HTML.

Thanks a lot!

Best regards,
Hans

Hi Hans,

Thanks
for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.