There are 6 updates, 1 comment.
 
 
XWiki Docker images / cid:jira-generated-image-avatar-7a60d1ac-ee42-4c72-ad11-3604d55acb0f XDOCKER-176 Closed

java.lang.NoClassDefFoundError at startup

 
View issue   ยท   Add comment
 

6 updates

 
cid:jira-generated-image-avatar-b44cf58b-1d7f-4241-a55f-08018fe7ba0a Changes by Vincent Massol on 17/Jul/26 21:50
 
Documentation in Release Notes: N/A
Documentation: N/A
Assignee: Vincent Massol
Priority: Major Minor
Resolution: Fixed
Status: Open Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-b44cf58b-1d7f-4241-a55f-08018fe7ba0a Vincent Massol on 17/Jul/26 21:48
 

This is still reproducible in the current images, and it is tied to headless mode.

Root cause

The JDK loads a different AWT backend native library depending on java.awt.headless:
* headless -> libawt_headless.so (no X11 dependencies)
* non-headless -> libawt_xawt.so, which hard-links libXtst.so.6 and libXi.so.6

Since the image installs LibreOffice with --no-install-recommends, most X11 libraries are pulled in transitively but libxtst6/libxi6 are not. So in non-headless mode, loading libawt_xawt.so fails with UnsatisfiedLinkError: libXtst.so.6: cannot open shared object file, which cascades into NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO whenever Solr/Tika indexes an image attachment.

Why it is rarely seen

Inside the container there is no DISPLAY and we do not set -Djava.awt.headless, so the JVM auto-defaults to headless=true and uses libawt_headless.so (no X11 needed). The problem only shows up when something forces non-headless: an explicit -Djava.awt.headless=false, or a DISPLAY variable present in the container. Note that explicitly setting -Djava.awt.headless=true (as in this report) is actually the safe configuration -- identical to the default -- so that flag was not the trigger; the crash requires non-headless mode.

Fix

Installed libxtst6 and libxi6 in the image (template Dockerfile + all regenerated variant Dockerfiles). Verified that with these libraries present, ldd libawt_xawt.so resolves fully and image parsing via ImageIO succeeds in both headless and non-headless modes.

(The separate NoClassDefFoundError: ...pdfbox.pdmodel.PDDocument seen in the report is unrelated -- it is the already-closed XWIKI-18306.)