41

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!

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Thorondor
  • 413
  • 1
  • 4
  • 7
  • I have removed the unanswered "followup" question, since this Q&A has turned into the canonical dup target for this kind of question. If for some reason you still need an answer to the followup, ask it as a separate question. – Stephen C Nov 06 '22 at 09:19

6 Answers6

77

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.

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
Vincent Gerris
  • 7,228
  • 1
  • 24
  • 22
  • I have searched for that general issue but haven't found anything, thanks for the link! And you are right, next time I will post a new questions, that was dumb. – Thorondor May 31 '21 at 09:27
  • 1
    This also worked for me on Ubuntu 18.04 to fix my Eclipse IDE startup error which said: `Failed to create improved startup dialog, falling back to Eclipse standard dialog. Please check Eclipse configuration logs for details.` – Gabriel Staples Jul 27 '21 at 18:07
  • 1
    I had open jdk 11 already installed. But something was missing. I did the following sudo apt install apt-file, sudo apt-file update, and then again sudo apt install openjdk-11-jdk after that it works. Found here https://ubuntu-mate.community/t/java-programs-stopped-working/24091/5 – Andreas L. Jan 23 '22 at 11:10
  • 1
    Oh yeah, just ran into the same problem with a completely different little app I wrote and my test system was being built with the JRE instead. Thanks for the pointer – AlexD Jul 28 '22 at 15:23
  • 1
    Same on Fedora, you should install `java-11-openjdk-devel` to have everything for Java development and avoid this error. – Gwendal Oct 26 '22 at 14:33
  • Fixed it for me as well. Thanks!. – Lucas Álvarez Lacasa May 26 '23 at 07:48
8

[For me it worked]

When you get this kinda error it means in installation of your jdk some of files are missed. To solve this problem act like bellow:

sudo apt install openjdk-[version]-jdk --fix-missing

eg.

sudo apt install openjdk-16-jdk --fix-missing

it means you already installed the jdk but there are some missing files with it. So you can fix it as easy as a pice of cake just by using '--fix-missing'

hassan bazai
  • 424
  • 6
  • 9
3

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

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • When I run this I get: `ldd: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so: No such file or directory` – Thorondor May 04 '21 at 20:50
  • 4
    You are missing that lib, perhaps you installed the headless version of your openjdk package? – Joakim Erdfelt May 04 '21 at 21:34
  • 2
    I can't remember how I installed openjdk but installing openjdk-11-jdk again resolved that error. But now I'm getting a different error. I'll add it at the bottom of my question. – Thorondor May 04 '21 at 21:39
  • Ok thanks, so there is no way to get this running? – Thorondor May 05 '21 at 08:32
  • For the BROWSE action issue see : https://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform . Installing the mentioned Gnome library may work: sudo apt-get install libgnome2-0. Also check yourself on the expected URL and port if the app runs, it basically attempts to open the browser for you, which fails because of a lack of implementation of the class. – Vincent Gerris Feb 23 '22 at 10:16
2

the solution is simple i had the problem and i solved it by:

sudo apt install default-jre
sudo apt upgrade openjdk-11-jdk 
helvete
  • 2,455
  • 13
  • 33
  • 37
mr me
  • 21
  • 1
1

/usr/lib/jvm/java-17-openjdk-17.0.4.1.1-1.fc36.x86_64/lib/libawt_xawt.so This error requires an updat of the jdk.

  1. Download the current update from Oracle support jdk-17_linux-x64_bin.rpm
  2. sudo rpm -ivh jdk-17_linux-x64_bin.rpm this will install libawt_headless.so and it is working Operating System deployed to is Fedora36
0
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk/lib/libawt_xawt.so
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2633)
        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:2445)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2501)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2700)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2651)
        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:1395)
        at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1393)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1392)
        at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1425)
        at java.desktop/java.awt.Insets.<clinit>(Insets.java:89)
        at java.desktop/javax.swing.plaf.synth.SynthLookAndFeel.<clinit>(SynthLookAndFeel.java:75)
        at snowflake.App.main(App.java:67)

If you get this error on Manjaro Linux when running any Java program (in my case SnowFlake), then you need to install openjdk11-src, jre11-openjdk, jdk11-openjdk

Inverser
  • 1
  • 1