Images are not displayed: java.lang.NoClassDefFoundError

Issue

When you request an image from your CQ instance, the error.log contains an error similar to the following:

*ERROR* Component: Error in cqImage java.lang.NoClassDefFoundError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62) at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1041) at com.day.image.Layer.initBaseImage(Layer.java:2862) at com.day.image.Layer.init(Layer.java:2852) at com.day.image.Layer.<init>(Layer.java:535)

Or, during instance startup you have an error in your error.log similar to the following:

08.05.2007 13:40:28 *ERROR* graphics: hasGraphics: getLocalGraphicsEnvironment throws java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Solution

Set a special JVM parameter to tell Java that the system does not have a graphical subsystem. Add the following line in your JVM parameters:

-Djava.awt.headless=true

Additional information

These errors can occur when the server does not have a graphical subsystem (UNIX without X).

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online