Jscv: Cannot find JVM library file

When I try to run the jsvc demo implementation, I get the following jsvc error output:

jsvc -cp ApacheDeamonDemo.jar -pidfile /mypath/pid.txt -outfile /mypath/log.txt -errfile /mypath/err.log net.example.deamon.DemoDeamon 

I get the following error message:

 Cannot find any VM in Java Home /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home Cannot locate JVM library file Service exit with a return value of 1 

Actually the way is right. Therefore, I do not understand why jsvc tells me about this. I am using mac.

+5
source share
2 answers

After almost five years, it may already be too late to help the original asker, but today I had the same problem when trying to run jsvc with open-jdk-11 for AMD64, so this might help someone later.

To diagnose the problem, I ran jsvc with the --debug flag, and this told me that it was suffocating when trying to find libjvm.so. I ran find/usr/lib/jvm/java-11-openjdk-amd64 -name libjvm.so and found it at /usr/lib/jvm/java-11-openjdk-amd64/lib/server/libjvm.so, but jsvc was looking for it at / usr / lib / jvm / java-11-openjdk-amd64 // lib / amd64 /server/libjvm.so. So, I did this, and then JSCV worked:

 sudo mkdir /usr/lib/jvm/java-11-openjdk-amd64/lib/amd64 sudo ln -s /usr/lib/jvm/java-11-openjdk-amd64/lib/server /usr/lib/jvm/java-11-openjdk-amd64/lib/amd64/ 

It turns out the problem is fixed in later versions of jsvc. I had a problem with jsvc version 1.0.6 that occurs when running apt install jsvc on Ubuntu 18.04. After I downloaded commons-daemon src version 1.2.0 from Apache and compiled jsvc myself, the problem was fixed and I no longer needed a symlink.

0
source

I don’t know why jsvc will try to find all the dylib files and load them with dlopen, but it seems to work poorly with the release of Apple Java. Although fixing jsvc might not be too complicated, I just started running the JVM myself,

 export JAVA_HOME=$(/usr/libexec/java_home) export CATALINA_HOME=/Users/rong/Projects/apache-tomcat-8.0.12 export CATALINA_BASE=$CATALINA_HOME java \ -server \ -classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar \ -Dcatalina.home=$CATALINA_HOME \ -Dcatalina.base=$CATALINA_BASE \ -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \ -Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \ org.apache.catalina.startup.Bootstrap \ > $CATALINA_BASE/logs/catalina.out \ 2> $CATALINA_BASE/logs/catalina.err 

By wrapping this in a bash script and adding a little fork, changing the UID stuff, you can completely forget about jsvc.

-3
source

Source: https://habr.com/ru/post/1202671/


All Articles