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

Can't start mvnd with noDaemon option

Open gboucherie opened this issue 11 months ago • 1 comments

Hi,

I try to start running mvnd with the mvnd.noDaemon option set to true but the process failed to start as it's missing the mvnd.java.home property. For what I understand by reading the code is that this property is normally set by the DaemonConnector class when starting in normal mode. But with noDaemon mode activated this property is not set before instantiate the Server class and then it fail to find it.

Here is the stacktrace I get.

gboucherie@barret:~$ mvnd.sh -Dmvnd.noDaemon --version
Apache Maven Daemon (mvnd) 1.0.2 JVM client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb)                                                                                                                  
Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.linux.LinuxNativePty
---------------------------------------------------
constituent[0]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/conf/logging/
constituent[1]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-daemon-1.0.2.jar
constituent[2]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/takari-smart-builder-1.0.0.jar
constituent[3]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/jline-terminal-ffm-3.26.3.jar
constituent[4]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/jline-terminal-jni-3.26.3.jar
constituent[5]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/jline-native-3.26.3.jar
constituent[6]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-agent-1.0.2.jar
constituent[7]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-helper-agent-1.0.2.jar
constituent[8]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-client-1.0.2.jar
constituent[9]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/jline-terminal-3.26.3.jar
constituent[10]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-native-1.0.2.jar
constituent[11]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/plexus-interactivity-api-1.3.jar
constituent[12]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd/mvnd-common-1.0.2.jar
constituent[13]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-plugin-api-3.9.9.jar
constituent[14]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-core-3.9.9.jar
constituent[15]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-model-builder-3.9.9.jar
constituent[16]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-embedder-3.9.9.jar
constituent[17]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-settings-builder-3.9.9.jar
constituent[18]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-repository-metadata-3.9.9.jar
constituent[19]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-connector-basic-1.9.22.jar
constituent[20]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-transport-http-1.9.22.jar
constituent[21]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-util-1.9.22.jar
constituent[22]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-artifact-3.9.9.jar
constituent[23]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-shared-utils-3.4.2.jar
constituent[24]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-compat-3.9.9.jar
constituent[25]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-transport-wagon-1.9.22.jar
constituent[26]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-model-3.9.9.jar
constituent[27]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-impl-1.9.22.jar
constituent[28]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-provider-3.9.9.jar
constituent[29]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-transport-file-1.9.22.jar
constituent[30]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-settings-3.9.9.jar
constituent[31]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-api-1.9.22.jar
constituent[32]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-named-locks-1.9.22.jar
constituent[33]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-builder-support-3.9.9.jar
constituent[34]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/maven-resolver-spi-1.9.22.jar
constituent[35]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/mvnd-logging-1.0.2.jar
constituent[36]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/wagon-http-shared-3.5.3.jar
constituent[37]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/commons-codec-1.17.1.jar
constituent[38]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/org.eclipse.sisu.inject-0.9.0.M3.jar
constituent[39]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/jcl-over-slf4j-1.7.36.jar
constituent[40]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/jul-to-slf4j-1.7.36.jar
constituent[41]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-cipher-2.0.jar
constituent[42]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-xml-3.0.1.jar
constituent[43]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/httpclient-4.5.14.jar
constituent[44]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-interpolation-1.27.jar
constituent[45]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/wagon-file-3.5.3.jar
constituent[46]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/javax.annotation-api-1.3.2.jar
constituent[47]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/commons-cli-1.8.0.jar
constituent[48]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/slf4j-api-1.7.36.jar
constituent[49]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-component-annotations-2.1.0.jar
constituent[50]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-sec-dispatcher-2.0.jar
constituent[51]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/org.eclipse.sisu.plexus-0.9.0.M3.jar
constituent[52]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/jansi-2.4.1.jar
constituent[53]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/failureaccess-1.0.2.jar
constituent[54]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/wagon-provider-api-3.5.3.jar
constituent[55]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/guava-33.2.1-jre.jar
constituent[56]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/wagon-http-3.5.3.jar
constituent[57]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/httpcore-4.4.16.jar
constituent[58]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/plexus-utils-3.5.1.jar
constituent[59]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/javax.inject-1.jar
constituent[60]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/guice-5.1.0.jar
constituent[61]: file:/home/gboucherie/.sdkman/candidates/mvnd/current/mvn/lib/aopalliance-1.0.jar
---------------------------------------------------
java.lang.RuntimeException: Unable to connect to internal daemon
	at org.mvndaemon.mvnd.client.DaemonConnector.connectNoDaemon(DaemonConnector.java:178)
	at org.mvndaemon.mvnd.client.DaemonConnector.connect(DaemonConnector.java:96)
	at org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:353)
	at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:171)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.mvndaemon.mvnd.client.DaemonConnector.lambda$connectNoDaemon$1(DaemonConnector.java:153)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.RuntimeException: Could not initialize org.mvndaemon.mvnd.daemon.Server
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:171)
	... 7 more
Caused by: java.lang.IllegalStateException: The system property mvnd.java.home is missing
	at org.mvndaemon.mvnd.common.Environment.asString(Environment.java:425)
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:159)
	... 7 more

I install mvnd with sdkman and use version 1.0.2.

Could it be a bug or I just missing some configurations. Thanks

gboucherie avatar Jan 24 '25 10:01 gboucherie

Same issue on 2.0-rc-3

$ mvnd.sh --version
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
Apache Maven 4.0.0-rc-3 (3952d00ce65df6753b63a51e86b1f626c55a8df2)
Maven home: /home/velo/.sdkman/candidates/mvnd/2.0.0-rc-3/mvn
Java version: 21.0.2, vendor: Oracle Corporation, runtime: /home/velo/.sdkman/candidates/java/21.0.2-open
Default locale: en_NZ, platform encoding: UTF-8
OS name: "linux", version: "6.12.10-76061203-generic", arch: "amd64", family: "unix"

Same error

---------------------------------------------------
java.lang.RuntimeException: Unable to connect to internal daemon
	at org.mvndaemon.mvnd.client.DaemonConnector.connectNoDaemon(DaemonConnector.java:178)
	at org.mvndaemon.mvnd.client.DaemonConnector.connect(DaemonConnector.java:96)
	at org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:353)
	at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:169)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at org.mvndaemon.mvnd.client.DaemonConnector.lambda$connectNoDaemon$1(DaemonConnector.java:153)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: Could not initialize org.mvndaemon.mvnd.daemon.Server
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:166)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	... 4 more
Caused by: java.lang.IllegalStateException: The system property mvnd.java.home is missing
	at org.mvndaemon.mvnd.common.Environment.asString(Environment.java:425)
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:154)

Adding the argument doesn't fix the problem

MVND_CLIENT=jvm mvnd.sh install -N -Dmvnd.noDaemon -Dmvnd.java.home=~/.sdkman/candidates/java/21.0.2-open

velo avatar Apr 07 '25 14:04 velo

It is difficult to reproduce this problem,I tried to modify mvnd.properties and it still works normally,The command line prohibits this parameter

maven-compiler-plugin git:(master) mvnd -Dmvnd.noDaemon=true -v
Apache Maven Daemon (mvnd) 1.0.2 darwin-aarch64 native client (cccc1ec8a5b741c62b29f9fb04d37b1678a029bb)                                Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jni.osx.OsXNativePty
Exception in thread "main" java.lang.UnsupportedOperationException: The mvnd.noDaemon property is not supported in native mode.
	at org.mvndaemon.mvnd.client.DaemonConnector.connectNoDaemon(DaemonConnector.java:129)
	at org.mvndaemon.mvnd.client.DaemonConnector.connect(DaemonConnector.java:96)
	at org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:353)
	at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:171)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

zhaoyunxing92 avatar Sep 05 '25 02:09 zhaoyunxing92