Update:  I've done some digging in the jsvc source code, and it appears to be 
at odds with the documentation [1].  The docs indicate that I can (a) write a 
Java class that implements the Daemon interface, or (b) define a class that 
implements four specific methods (init, start, stop, destroy, with specific 
signatures).

If I choose (a), the docs say I needs to put the commons-daemon jar on my 
classpath (an obvious requirement), but if I choose (b), then the jar is not 
needed.  However, the jsvc source code seems to load the DaemonLoader class in 
both cases, and so therefore the jar is always required.

Can a someone familiar with the jsvc internals confirm this analysis?  If I am 
correct, then I will enter a JIRA issue against the docs.

Thanks,

Ian

[1] http://commons.apache.org/proper/commons-daemon/jsvc.html#Using_jsvc


On Mar 1, 2013, at 4:06 PM, Ian Emmons <[email protected]> wrote:
> I am trying to use jsvc to launch my program on Ubuntu 12.10 with Java 7:
> 
> $ java -version
> java version "1.7.0_15"
> OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.10)
> OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
> 
> With the -debug flag, jsvc reports that it correctly finds and loads the JVM 
> shared lib:
> 
> /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server/libjvm.so
> 
> At the very end of the log, jsvc reports the following:
> 
> Java VM created successfully
> Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader
> java_init failed
> 
> I am not surprised that jsvc can't find DaemonLoader, since I only built the 
> native part of commons-daemon.  However, I thought I understood from the docs 
> that I didn't need DaemonLoader if the entry point class on the jsvc command 
> line implemented the magic four methods.  The public interface of my entry 
> point class looks like this:
> 
> public class JettyDaemon {
>   public void init(String[] args) { ... }
>   public void start() { ... }
>   public void stop() { ... }
>   public void destroy() { ... }
> }
> 
> Why does jsvc not load and execute this class directly?  Is there a way to 
> get jsvc to print diagnostics about the loading process?  Or is it the case 
> that jsvc requires the DaemonLoader Java class to be available?
> 
> Thanks,
> 
> Ian


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to