Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception java.lang.UnsatisfiedLinkError when trying to open allure-reports in webdriver.io project

I have a small webdriver.io project just for experimenting with it for the first time. I now wanted to add allure reports but when I try to run allure open I get the following exception and I have no idea where I have to look to resolve this:

Starting web server...
2021-05-04 22:06:43.669:INFO::main: Logging initialized @349ms to org.eclipse.jetty.util.log.StdErrLog
Exception in thread "main" 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)
        at java.base/java.lang.Runtime.load0(Runtime.java:768)
        at java.base/java.lang.System.load(System.java:1837)
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
        at java.base/java.lang.System.loadLibrary(System.java:1873)
        at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1399)
        at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1397)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1396)
        at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1429)
        at java.desktop/java.awt.Desktop.isDesktopSupported(Desktop.java:328)
        at io.qameta.allure.Commands.openBrowser(Commands.java:220)
        at io.qameta.allure.Commands.open(Commands.java:152)
        at io.qameta.allure.CommandLine.run(CommandLine.java:165)
        at java.base/java.util.Optional.orElseGet(Optional.java:369)
        at io.qameta.allure.CommandLine.main(CommandLine.java:88)

The reports are getting generated just fine. Only when I try to open them I get this error.

I have allure-reporter and allure-commandline installed via npm. I have my project inside a Debian WSL and run chromedriver with VcXsrv X Server in case this might help.

Does anybody have an idea how this error might get resolved or have a hint for what to look for? I hope I gave you enough information. If not, just say what you need. Thanks in advance for your help!

EDIT: I installed openjdk-11-jdk again and that resolved the original error. But now I'm getting the following message:

2021-05-04 23:33:34.871:INFO::main: Logging initialized @395ms to org.eclipse.jetty.util.log.StdErrLog
Browse operation is not supported on your platform.You can use the link below to open the report manually.
java.lang.UnsupportedOperationException: The BROWSE action is not supported on the current platform!
        at java.desktop/java.awt.Desktop.checkActionSupport(Desktop.java:380)
        at java.desktop/java.awt.Desktop.browse(Desktop.java:524)
        at io.qameta.allure.Commands.openBrowser(Commands.java:222)
        at io.qameta.allure.Commands.open(Commands.java:152)
        at io.qameta.allure.CommandLine.run(CommandLine.java:165)
        at java.base/java.util.Optional.orElseGet(Optional.java:369)
        at io.qameta.allure.CommandLine.main(CommandLine.java:88)
Server started at <http://127.0.1.1:46223/>. Press <Ctrl+C> to exit

And when I follow that link its not reachable.

like image 622
Thorondor Avatar asked May 04 '21 20:05

Thorondor


2 Answers

on ubuntu 20.04:

sudo apt install openjdk-11-jdk

As Joakim suggested in this comment here, the headless version was installed. I got the same error with ldd, the library missing.

It's not a good idea to change your question in general, it's better to search first and ask a new one if needed, with all specifics.

This may help you understand the possible cause of the second issue:

Desktop API is not supported on the current platform

I highly recommend to use a plain Ubuntu Linux installation if you want to use Linux, WSL is not the same and has specific issues that you will not encounter in Linux. If a dedicated install is not an option, try to look for generic issues. Expect differences in behavior with shells, docker and graphical related things, because those things are specifically implemented in certain ways for WSL.

like image 134
Vincent Gerris Avatar answered Oct 27 '22 14:10

Vincent Gerris


You likely have some missing downstream libraries.

Run this to find out which ones, then install them.

$ ldd /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
java.lang.UnsupportedOperationException: The BROWSE action is not supported on the current platform!
       at java.desktop/java.awt.Desktop.checkActionSupport(Desktop.java:380)
       at java.desktop/java.awt.Desktop.browse(Desktop.java:524)
       at io.qameta.allure.Commands.openBrowser(Commands.java:222)

That means WSL doesn't support java.awt.Desktop.browse().

This has been brought up before in Stackoverflow.

See https://stackoverflow.com/a/27881223/775715

like image 42
Joakim Erdfelt Avatar answered Oct 27 '22 13:10

Joakim Erdfelt