How can I get Jsvc to find DaemonLoader?

I have commons-daemon-x.jar in the classpath . Jsvc successfully starts a Java virtual machine. But jsvc reports that it cannot find the daemon loader class, even if it is in the classpath .

Does anyone know how to solve this problem? Im works under Mac OS X 10.8.3. Thanks.

Here is an excerpt from jsvc debug output:

 ... +-- DUMPING JAVA VM CREATION ARGUMENTS ----------------- | Version: 0x010004 | Ignore Unrecognized Arguments: False | Extra options: 1 | "-Djava.class.path=commons-daemon-1.0.15.jar:./api-monitor.jar" (0x00000000) +β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€” ... Java VM created successfully Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader java_init failed Service exit with a return value of 1 ... 

Get full debug output if it helps:

 sudo jsvc -jvm server -debug -cp commons-daemon-1.0.15.jar:./api-monitor.jar ApiMonitorDaemon +-- DUMPING PARSED COMMAND LINE ARGUMENTS -------------- | Detach: True | Show Version: No | Show Help: No | Check Only: Disabled | Stop: False | Wait: 0 | Run as service: No | Install service: No | Remove service: No | JVM Name: "server" | Java Home: "null" | PID File: "/var/run/jsvc.pid" | User Name: "null" | Extra Options: 1 | "-Djava.class.path=commons-daemon-1.0.15.jar:./api-monitor.jar" | Class Invoked: "ApiMonitorDaemon" | Class Arguments: 0 +------------------------------------------------------- Home not specified on command line, using environment Home not on command line or in environment, searching Attempting to locate Java Home in /System/Library/Frameworks/JavaVM.framework/Home Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/jre/lib/jvm.cfg Attempting to locate VM configuration file /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM configuration file at /System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg Found VM client definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib Found VM jvm definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib Found VM hotspot definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib Found VM server definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Found VM classic definition in configuration Checking library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclassic.dylib Cannot locate library for VM classic (skipping) Java Home located in /System/Library/Frameworks/JavaVM.framework/Home +-- DUMPING JAVA HOME STRUCTURE ------------------------ | Java Home: "/System/Library/Frameworks/JavaVM.framework/Home" | Java VM Config.: "/System/Library/Frameworks/JavaVM.framework/Home/lib/jvm.cfg" | Found JVMs: 4 | JVM Name: "client" | "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libclient.dylib" | JVM Name: "jvm" | "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libjvm.dylib" | JVM Name: "hotspot" | "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libhotspot.dylib" | JVM Name: "server" | "/System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib" +------------------------------------------------------- my-server:Applications developer$ redirecting stdout to /dev/null and stderr to /dev/null Switching umask back to 022 from 077 Using specific JVM in /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib Attemtping to load library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib JVM library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libserver.dylib loaded Attemtping to load library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib Shell library /System/Library/Frameworks/JavaVM.framework/Home/../Libraries/libverify.dylib loaded JVM library entry point found (0x02A49762) +-- DUMPING JAVA VM CREATION ARGUMENTS ----------------- | Version: 0x010004 | Ignore Unrecognized Arguments: False | Extra options: 1 | "-Djava.class.path=commons-daemon-1.0.15.jar:./api-monitor.jar" (0x00000000) +------------------------------------------------------- | Internal options: 4 | "-Dcommons.daemon.process.id=8919" (0x00000000) | "-Dcommons.daemon.process.parent=8918" (0x00000000) | "-Dcommons.daemon.version=1.0.15-dev" (0x00000000) | "abort" (0x022bef30) +------------------------------------------------------- Java VM created successfully Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader java_init failed Service exit with a return value of 1 
+4
source share
2 answers

You probably found a solution at the moment, but in case someone stumbles upon it in the future, what I missed in my case is that the current directory defaults to '/', so you should specify it if you want to use relative paths.

 sudo jsvc -jvm server -cwd /path/to/my/daemon/ -cp commons-daemon-1.0.15.jar:./api-monitor.jar ApiMonitorDaemon 

Note: my OS is ubuntu 12.10

+10
source

Check the permissions of the commons-daemon-1.0.15.jar , make sure that your current user can read it.

-1
source

All Articles