maven-mvnd icon indicating copy to clipboard operation
maven-mvnd copied to clipboard

java.lang.ExceptionInInitializerError & java.lang.NoClassDefFoundError (Linux)

Open TotallyMehis opened this issue 11 months ago • 4 comments

Running mvnd -v I get the following output:

Apache Maven Daemon (mvnd) 2.0.0-rc-1 linux-amd64 native client (39127a46697aa1f64d19b106f943a1a13c9f1637)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
java.lang.ExceptionInInitializerError: null

Running the command again gives me:

Apache Maven Daemon (mvnd) 2.0.0-rc-1 linux-amd64 native client (39127a46697aa1f64d19b106f943a1a13c9f1637)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
java.lang.NoClassDefFoundError: Could not initialize class org.mvndaemon.mvnd.nativ.CLibrary

JDK seems to start fine (mvnd --status):

      ID      PID                   Address   Status    RSS            Last activity  Java home
a20ab7f2    29901     inet:/127.0.0.1:41293     Idle    83m  2025-02-08T20:59:39.253  /home/miikka/.sdkman/candidates/java/21.0.6-amzn 

I am using Fedora 41. JDK:

openjdk version "21.0.6" 2025-01-21 LTS
OpenJDK Runtime Environment Corretto-21.0.6.7.1 (build 21.0.6+7-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.6.7.1 (build 21.0.6+7-LTS, mixed mode, sharing)

Related to #872 ?

TotallyMehis avatar Feb 08 '25 19:02 TotallyMehis

Yes, there was a LOT of related changes in mvn and mvnd (both master), and due these changes not yet ported to mvnd, you cannot build it currently. Soon will merge https://github.com/apache/maven-mvnd/pull/1253 that will "align" mvnd and mvn, and JLine3 stuff should be fully aligned.

cstamas avatar Feb 08 '25 19:02 cstamas

Hi there.

I still get a NoClassDefFoundError with 2.0.0-rc-3:

➜  mvnd -v
Apache Maven Daemon (mvnd) 2.0.0-rc-3 linux-amd64 native client (f912362c18c9a75faf3e31a4e0e0b921206013b9)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
java.lang.ExceptionInInitializerError: null
➜  mvnd -v
Apache Maven Daemon (mvnd) 2.0.0-rc-3 linux-amd64 native client (f912362c18c9a75faf3e31a4e0e0b921206013b9)
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
java.lang.NoClassDefFoundError: Could not initialize class org.mvndaemon.mvnd.nativ.CLibrary
➜  mvnd --status
      ID      PID                   Address   Status    RSS            Last activity  Java home
e80d8651   149257     inet:/127.0.0.1:35799     Idle    65m  2025-04-02T09:15:22.881  /home/xyz1234/.sdkman/candidates/java/17.0.12-amzn

My environment: Fedora 41

➜  which mvnd
~/.sdkman/candidates/mvnd/current/bin/mvnd
➜  mvn -v
Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Maven home: /home/xyz1234/tools/maven
Java version: 17.0.12, vendor: Amazon.com Inc., runtime: /home/.xyz1234/.sdkman/candidates/java/17.0.12-amzn
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.13.8-200.fc41.x86_64", arch: "amd64", family: "unix"

zapho avatar Apr 02 '25 07:04 zapho

I'm not very Linux savvy, but I was able to get mvnd to work by building it myself. Just had to install the static version of zlib.

TotallyMehis avatar Apr 02 '25 14:04 TotallyMehis

Having this issue on Fedora 43 as well.

reinouts avatar Nov 06 '25 15:11 reinouts