Wednesday, October 4, 2017

Nexus 2.14 not starting "No such file or directory"

scary, all of a sudden I get in the wrapper.log file:

jvm 1 | wrapper | Unable to start JVM: No such file or directory (2)

this is really unimpressive, a decent coder would AT LEAST tell you "WHICH file or directory" could not be found.... but most developers are just selfish jerks who don't care about operations.

I edit the "bin/nexus" script to put a "set -x" at the beginning, and I discover that the command used to execute the wrapper is

/u01/app/admrun/nexus-java/bin/../bin/jsw/linux-x86-64/wrapper /u01/app/admrun/nexus-java/bin/../bin/jsw/conf/wrapper.conf wrapper.syslog.ident=nexus wrapper.pidfile=/u01/app/admrun/nexus-java/bin/../bin/jsw/linux-x86-64/nexus.pid wrapper.daemonize=TRUE


if you run the command with wrapper.daemonize=FALSE you can see the errors directly in the console - which is easier to debug.

useful post here https://stackoverflow.com/questions/29355815/error-in-sonar-startup-unable-to-start-jvm-no-such-file-or-directory-2

there I discover that there is an extra parameter wrapper.java.command, and in fact in wrapper.conf I see

# Set the JVM executable
# (modify this to absolute path if you need a Java that is not on the OS path)
wrapper.java.command=java


in fact, I don't have "java" in my path:

which java
/usr/bin/which: no java in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/u01/app/admrun/bin)


I try to set it to "wrapper.java.command=/u01/app/java/jdk1.8.0_45/bin/java" and it magically works

All this is really, really sad. A start script should CLEARLY validate all preconditions and give a very explanatory message stating what is wrong and how to fix it. Pathetic.






1 comment:

Anonymous said...

Thanks! This helped me quickly solve my issue.