4

I don't understand what went wrong with me. I'm trying to run Spigot Server Core 1.18.2, and I'm constantly having problems with this library.

[19:21:50 INFO]: [STDERR]: java.lang.UnsatisfiedLinkError: /opt/jdk17/lib/libawt_xawt.so: libXrender.so.1: cannot open shared object file: No such file or directory [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.Runtime.load0(Runtime.java:755) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.System.load(System.java:1953) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:315) [19:21:50 INFO]: [STDERR]: at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:285) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818) [19:21:50 INFO]: [STDERR]: at java.base/java.lang.System.loadLibrary(System.java:1989) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1388) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1386) [19:21:50 INFO]: [STDERR]: at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1385) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Toolkit.initStatic(Toolkit.java:1423) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Toolkit.(Toolkit.java:1397) [19:21:50 INFO]: [STDERR]: at java.desktop/java.awt.Component.(Component.java:624)

2
  • This exception has to do with either a missing library or a classpath issue when running code that has already been compiled successfully Commented Apr 28, 2022 at 20:03
  • does the file /opt/jdk17/lib/libawt_xawt.so exist and is readable by the user that executes the java program? (For a service this could be a different user than your own) Does the file libXrender.so.1 exist? (probably in the same directory, but could anywhere in the java library path specified with the system property java.library.path)
    – cyberbrain
    Commented Apr 29, 2022 at 19:40

3 Answers 3

11

This problem seems to stem from Java attempting to load GUI-related classes in non-gui environment, like headless server. Perhaps adding -Djava.awt.headless=true to java command would help, if the application supports that, and does not in fact require to run in Desktop environment.

3
  • 1
    I got that error when running mvn build on wsl- ubuntu. your solution works but is there a permanent solution?
    – Ajeetkumar
    Commented Apr 21, 2023 at 12:19
  • @Ajeetkumar it's not clear to me what's the root cause of your problem. The permanent solution may be to add the flag to your build command as much as to upgrade you stack - recent versions of Windows, for example, handle GUI apps natively, and should not cause this error - as long as you access the WSL console within desktop session.
    – JockX
    Commented Apr 24, 2023 at 18:47
  • had the same error on a bungeecord proxy. This solution worked!
    – Likqez
    Commented Jun 1, 2023 at 14:33
4

I know it's late for this, but what worked for me was:

apt-get install libxrender1:i386 libxtst6:i386 libxi6:i386

2
  • 4
    I had a this error, though in my case I was on WSL Ubuntu 22.04 and had recently done wsl --update. A maven plugin suddenly started complaining about missing/unlinked libs. I had to apt-get install the following packages: libxrender1, libxtst, libxtst6, libxi6
    – Joel
    Commented Aug 8, 2023 at 14:45
  • the comment here worked for me on wsl2 except libxtst wasn't found so I just did the others and it seems to be working. Commented Aug 26, 2023 at 5:03
0

I ran into the same problem when depolying Jenkins on Ubuntu. Just like below:

root@VM-Agent-Service-Uat:~/jdk/jdk-17.0.10+7# java -version
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7)
OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing)

root@VM-Agent-Service-Uat:~/jdk/jdk-17.0.10+7# cat /proc/version
Linux version 6.5.0-1021-azure (buildd@lcy02-amd64-097) (x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #22~22.04.1-Ubuntu SMP Tue Apr 30 16:08:18 UTC 2024

After these packages were installed, this exception was fixed. Thank you, Guys! These codes just work in my case:

apt-get install libxrender1

apt-get install libxtst6

apt-get install libxi6

Hopefully, my experience can help more.

Not the answer you're looking for? Browse other questions tagged or ask your own question.