There are 7 comments.
 
 
XWiki Docker images / cid:jira-generated-image-avatar-8f801761-bedd-411c-b6c2-5e165e4c7f57 XDOCKER-176 Closed

java.lang.NoClassDefFoundError at startup

 
View issue   ยท   Add comment
 

7 comments

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:18
 
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 libawt\_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:18
 
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 libawt_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt\_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:20
 
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 libawt\_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:20
 
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 libawt_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt\_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:21
 
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 libawt_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt\_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:21
 
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 libawt\_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt_xawt 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 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 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 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. \ )

 
cid:jira-generated-image-avatar-b76a021c-c2ee-4473-ac4c-5d3c34024b7f Vincent Massol on 18/Jul/26 17:23
 
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 libawt_headless .so}} \ (no X11 dependencies \ )
\ * non \ -headless \ -> {{ libawt\_xawt 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 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 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 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. \ )