Expand my Community achievements bar.

Embedded Images are not loading

Avatar

Level 3

While loading the embedded image we are getting below error

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable

java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE

  at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)

we have already added this -Djava.awt.headless=true in parameter while starting the AEM instance

 

AEM version 6.5.15

core component version : 2.20.8

 

 

Please suggest any solution

3 Replies

Avatar

Level 8

@adivj95 

Along with "-Djava.awt.headless=true ", try adding the below property as well and restart AEM instance.

-Dcom.sun.media.jai.disableMediaLib=true

 

Avatar

Level 10

Hi @adivj95 ,

The error you are encountering with embedded images not loading and the `java.lang.NoClassDefFoundError` related to `java.awt.GraphicsEnvironment$LocalGE` is likely due to the fact that AEM does not support the use of the `java.awt` package, including the `GraphicsEnvironment` class, in the context of server-side rendering.

To resolve this issue, you can try the following steps:

1. Ensure that you have set the `java.awt.headless` system property to `true` in the AEM instance's startup script or command. This property is required to enable headless mode, which allows AEM to run without a graphical environment.

2. Verify that the issue is not caused by any custom code or components that are attempting to use the `java.awt` package. Check your codebase for any references to `java.awt` and remove or refactor them as necessary.

3. If you are using any third-party libraries or dependencies that rely on `java.awt`, consider finding alternative solutions or libraries that do not depend on it. This may involve updating or replacing the affected libraries.

4. Ensure that you are using the latest version of the AEM Core Components. Check the release notes and documentation for any known issues or compatibility requirements related to embedded images.

5. If the issue persists, consider reaching out to Adobe Support or the AEM community for further assistance. They may be able to provide specific guidance or solutions based on your environment and configuration.

It's worth noting that server-side rendering of images in AEM is typically done using the Apache Sling Dynamic Media feature or other image rendering techniques specific to AEM. Using the `java.awt` package for image rendering is not recommended or supported in AEM.

Avatar

Administrator

@adivj95 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni