Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047009Openbravo ERPA. Platformpublic2021-06-07 15:312022-01-06 09:20
shuehner 
shuehner 
urgentminorhave not tried
closedfixed 
5
 
PR21Q3 
Core
No
0047009: Running backoffice selenium tests fails with only openjdk-11-jre-headless installed but gui environment available
Server environments typically only have the -headless variant of java installed (all except GUI parts).
Ubuntu java packaging until recently included some GUI libraries also in the -headless variant but just 'fixed' that issue.

However that break usecases which accidentally relied on the old behavior.

One of them is the the java.imageio.ImageIO code of the JDK auto-detect if it runs in a GUI environment (i.e. DISPLAY environment var set) and if it does requires the full java to be installed. When not running in an GUI it works without problems with only the -headless.

The Image.java class in our backoffice-tests is hit by this behavior change if run on our CI environment (as in there the GUI is available to be able to run firefox)
Have openjdk-11-jdk-headless installed
Do NOT have openjdk-11-jdk package installed

Run the following test (from configured backoffice-test workspace)
ant -f src-test/com/openbravo/test/integration/erp/modules/client/application/testsuites/navigationbarcomponents/build.xml test.integration.erp.modules.client.application.testsuites.navigationbarcomponents.NAV0140_CheckYourCompanyLogo

It fails with:
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2630)
Add -Djava.awt.headless=true argument to the JVM running the tests to tell java it is not running in a GUI environment.
No tags attached.
related to feature request 0046492 closed ranjith_qualiantech_com Retail Modules Please run hardware manager without Java UI in CI 
depends on backport 0047010PR21Q2 closed shuehner Openbravo ERP Running backoffice selenium tests fails with only openjdk-11-jre-headless installed but gui environment available 
depends on backport 0047011PR21Q1.3 closed shuehner Openbravo ERP Running backoffice selenium tests fails with only openjdk-11-jre-headless installed but gui environment available 
Issue History
2021-06-07 15:31shuehnerNew Issue
2021-06-07 15:31shuehnerAssigned To => shuehner
2021-06-07 15:31shuehnerModules => Core
2021-06-07 15:31shuehnerTriggers an Emergency Pack => No
2021-06-07 15:31shuehnerStatusnew => scheduled
2021-06-07 15:37hgbotResolutionopen => fixed
2021-06-07 15:37hgbotStatusscheduled => resolved
2021-06-07 15:37hgbotNote Added: 0129141
2021-06-07 15:38hgbotNote Added: 0129143
2021-06-07 15:40shuehnerFixed in Version => PR21Q3
2021-06-07 16:09shuehnerRelationship addedrelated to 0046492
2021-06-08 09:50shuehnerNote Added: 0129167
2021-06-08 09:50shuehnerStatusresolved => closed
2022-01-05 12:11hgbotStatusclosed => resolved
2022-01-05 12:11hgbotNote Added: 0134132
2022-01-06 09:20shuehnerNote Added: 0134143
2022-01-06 09:20shuehnerStatusresolved => closed

Notes
(0129141)
hgbot   
2021-06-07 15:37   
Repository: https://gitlab.com/openbravo/ci/backoffice-test [^]
Changeset: be6733ec30bd7e7866bd89f2c1ab610ea26fc782
Author: Stefan Huehner <stefan@huehner.org>
Date: 2021-06-07T15:33:19+02:00
URL: https://gitlab.com/openbravo/ci/backoffice-test/-/commit/be6733ec30bd7e7866bd89f2c1ab610ea26fc782 [^]

Fixes ISSUE-47009: Add java.awt.headless argument when running tests.

Avoid error about
java.lang.UnsatisfiedLinkError: Can't load library:
    /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

happening when only having openjdk-11-jdk-headless (but not
openjdk-11-jdk) installed while having GUI environment available.

Set the headless flag unconditionally. As junit run is forked from
inside ANT easiest is to add the flag directly in the build system.

---
M build.xml
---
(0129143)
hgbot   
2021-06-07 15:38   
Repository: https://gitlab.com/openbravo/ci/backoffice-test [^]
Changeset: 89953e954e75ccde9f84624c17f43444eb84d8a4
Author: Stefan Huehner <stefan@huehner.org>
Date: 2021-06-07T15:37:48+02:00
URL: https://gitlab.com/openbravo/ci/backoffice-test/-/commit/89953e954e75ccde9f84624c17f43444eb84d8a4 [^]

Fixes ISSUE-47009: Add java.awt.headless argument when running tests.

Avoid error about
java.lang.UnsatisfiedLinkError: Can't load library:
    /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

happening when only having openjdk-11-jdk-headless (but not
openjdk-11-jdk) installed while having GUI environment available.

Set the headless flag unconditionally. As junit run is forked from
inside ANT easiest is to add the flag directly in the build system.

---
M build.xml
---
(0129167)
shuehner   
2021-06-08 09:50   
Closing after CI jobs are no longer failing with the fix applied.
(0134132)
hgbot   
2022-01-05 12:11   
Repository: https://gitlab.com/openbravo/ci/backoffice-test [^]
Changeset: be6733ec30bd7e7866bd89f2c1ab610ea26fc782
Author: Stefan Huehner <stefan@huehner.org>
Date: 07-06-2021 15:33:19
URL: https://gitlab.com/openbravo/ci/backoffice-test/-/commit/be6733ec30bd7e7866bd89f2c1ab610ea26fc782 [^]

Fixes ISSUE-47009: Add java.awt.headless argument when running tests.

Avoid error about
java.lang.UnsatisfiedLinkError: Can't load library:
    /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

happening when only having openjdk-11-jdk-headless (but not
openjdk-11-jdk) installed while having GUI environment available.

Set the headless flag unconditionally. As junit run is forked from
inside ANT easiest is to add the flag directly in the build system.

---
M build.xml
---
(0134143)
shuehner   
2022-01-06 09:20   
Re-closing was only changed back to resolved by backoffice-test devel>master merge which now happened