2

I am trying to run Oracle SQL Developer 22.2.1 under Manjaro 22.0.1 using openjdk version "17.0.6" 2023-01-17. For debugging purposes, I have experimented with and yielded the same results using openjdk version "11.0.18" 2023-01-17. Both have been installed using pacmanfrom the official arch repositories (jre17-openjdk and jre11-openjdk respectively).

This resulted in the following error:

> oracle-sqldeveloper
Error occurred during initialization of boot layer
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-17-openjdk/lib/libnio.so: /usr/lib/jvm/java-17-openjdk/lib/libnio.so: undefined symbol: reuseport_available

Inspecting libnio.so more closely, the culprit seems to actually be libjvm.so:

> ldd /usr/lib/jvm/java-17-openjdk/lib/libnio.so                                                                                                                                                                         
        linux-vdso.so.1 (0x00007ffe0f1d7000)
        libjava.so => /usr/lib/jvm/java-17-openjdk/lib/libjava.so (0x00007f7354ce7000)
        libnet.so => /usr/lib/jvm/java-17-openjdk/lib/libnet.so (0x00007f7354ccf000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f7354abb000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f7354d23000)
        libjvm.so => not found
        libjvm.so => not found

This is in turn located under /usr/lib/jvm/java-17-openjdk/lib/server/libjvm.so. A bit of research here and there yields setting the LD_LIBRARY_PATH as a potential solution. And indeed, by doing so, the application starts just fine!

Now finally on to my actual questions:

  • Is this some problem with my JDK installation and those links are supposed to work out-of-the-box?
  • I am regularly working with 2-3 different JDK installations (openjdk and GraalVM 8, 11 and 17). How would I best set the LD_LIBRARY_PATH for those different versions that each have their own lib directories?

Currently, I am only facing the problems with SQL Developer. I have already explicitly set the Java version to use in ~/.sqldeveloper/22.2.1/product.conf. Maybe there would also be a possibility to supply the library path in there? Using -Djava.library.path did not work so far.

Michael Lang
  • 3,902
  • 1
  • 23
  • 37
  • 2
    FYI the product is setup to be ran with Oracle JDK, and doesn't technically support OpenJDK. – thatjeffsmith Feb 02 '23 at 13:53
  • @thatjeffsmith I now tested the same with Oracle JDK 19. It was installed from the AUR (https://aur.archlinux.org/packages/jdk). It yields the same problem! The only difference is the undefined symbol is now `undefined symbol: ipv6_available`. – Michael Lang Feb 14 '23 at 16:23
  • well we dont support 19 either, it's oracle java 11, that what we test for, and distribute for windows and macs – thatjeffsmith Feb 14 '23 at 16:37
  • @thatjeffsmith thanks for the clarification! Unfortunately, it's exactly the same problem with Oracle JDK11. `jdk-11.0.17_linux-x64_bin.tar.gz` downloaded manually from oracle.com trying to reference `libjvm.so` that it can't locate in the `lib/server` directory without explicitly setting the `LD_LIBRARY_PATH`. – Michael Lang Feb 15 '23 at 06:43
  • do we know your java is a valid home? Can you for example start sqlcl (it's the sql.sh in your sqldeveloper/bin) directory. From a cmd prompt, just run sql /nolog . Then if that gets you a prompt, run 'show java' . Is it using the same home you think SQLDev is ? – thatjeffsmith Feb 15 '23 at 15:19
  • @thatjeffsmith No, I cannot start it as my default jdk installation is openjdk8. This is required by my daily business and the reason that I've used `SetJavaHome` in `product.conf`. `JAVA_HOME` is not explicitly set. Is there anything else that you'd relate to "a valid home"? – Michael Lang Feb 17 '23 at 14:55
  • we don't support openJDK, esp openJDK 8 - i would expect problems – thatjeffsmith Mar 10 '23 at 12:53

3 Answers3

1

On my Manjaro installation, i've set the environment variables:

export JAVA_HOME=/usr/lib/jvm/default

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/default/lib/server

I set the variables appointing to the default symlink, to appoint to default JVM set from the archlinux-java program. Before set this variables, the Oracle SQL Developer has opened normally.


From the .desktop file, other change is necessary. To do this, you can use the menulibre to edit the Oracle SQL Developer SQL Entry. In the command field (equivalent to the line which starts from Exec= text), change to the below line:

env LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/default/lib/server /usr/bin/oracle-sqldeveloper


My solution is derived from the 'drslmr' solution to fix the Eclipse installation: https://aur.archlinux.org/packages/eclipse-java#news

0

As @thatjeffsmith has commented I would not expect SQLDeveloper to work 100% with OpenJDK (even if Oracle says so).

About your specific scenario the only answer I can think of is having scripts (think of catalina.sh or catalina.bat) to specify diferent locations for that specific environment variable (LD_LIBRARY_PATH). This is not a Java problem, but more a specific JNI problem, which needs to be solved under the JVM (as opposed to IN the JVM).

  • I now tested the same with Oracle JDK 19. It was installed from the AUR (https://aur.archlinux.org/packages/jdk). It yields the same problem! The only difference is the undefined symbol is now `undefined symbol: ipv6_available`. – Michael Lang Feb 14 '23 at 16:23
0

I'll leave my final solution here for reference in case anyone else also stumbles across that issue:

Oracle SQLDeveloper, at least on arch installations, also requires the java11-openjfx package. The PKGBUILD file even says so and lists it as an optional dependency. So all that was left to do after installing that was to reference the proper (on my system non-default) JDK installation to use in the product.conf:

SetJavaHome /usr/lib/jvm/java-11-jdk

Michael Lang
  • 3,902
  • 1
  • 23
  • 37