i assume this is not a permissions issue does your main class implement org.apache.commons.daemon.Daemon?
does your main class override init method? @Override public void init(DaemonContext dc) throws DaemonInitException, Exception does your main class override start method? @Override public void start() throws Exception does your classpath contain commons-daemon AND your jar e.g. CLASSPATH="/usr/share/java/commons-daemon.jar":"/path/to/your.jar" did you run jsvc.exe with -home parameter and -cp param e.g. jsvc -home "$JAVA_HOME -cp $CLASSPATH mypackage.myClass ? http://stackoverflow.com/questions/7687159/how-to-convert-a-java-program-to-daemon-with-jsvc ? Martin > From: andrew.mar...@exactearth.com > To: user@commons.apache.org > Subject: RE: [daemon] > Date: Thu, 17 Jul 2014 17:21:57 +0000 > > Hi Martin, > > PATH= > /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/apache-maven-3.1.1/bin:/root/bin > > I don't have JAVA_HOME set as an environment variable but I pass it into > jsvc: /usr/lib/jvm/java-1.7.0 > > CLASSPATH: The full pathname to my main jar. The manifest inside the jar has > the rest of the dependencies, including commons-daemon. I know this is fine, > because if I just run the jar using java -jar, it works. I also know that it > is being passed correctly to jsvc, because when I remove it I get a more > fundamental error. > > Best, > Andrew > > -----Original Message----- > From: Martin Gainty [mailto:mgai...@hotmail.com] > Sent: July-17-14 1:03 PM > To: Commons Users List > Subject: RE: [daemon] > > can you display PATH, CLASSPATH and JAVA_HOME please > assume: > PATH folder = folders for all executables? > CLASSPATH folders = contains all classes referenced by main java > class..including local folder e.g. $CLASSPATH = .:$CLASSPATH ? > files that are read are in SAME directory where you executed jsvc.exe ? > JAVA_HOME is set to base folder of JAVA installation ? > > what happens when you run the same class using java.exe mypackage.MyClass ? > > Martin > ___________________________ > > > > From: andrew.mar...@exactearth.com > > To: user@commons.apache.org > > Subject: RE: [daemon] > > Date: Thu, 17 Jul 2014 16:42:51 +0000 > > > > The output is identical to what I sent in the last email: > > > > java.lang.InstantiationException: mypackage.MyClass > > at java.lang.Class.newInstance(Class.java:359) > > at > > org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190) > > 17/07/2014 17:39:24 10600 jsvc.exec error: Cannot load daemon > > 17/07/2014 17:39:24 10599 jsvc.exec error: Service exit with a return value > > of 3 > > > > This is from the error file. Nothing in the stdout file. > > > > Andrew > > > > -----Original Message----- > > From: Martin Gainty [mailto:mgai...@hotmail.com] > > Sent: July-17-14 12:37 PM > > To: Commons Users List > > Subject: RE: [daemon] > > > > jsvc.exe -outfile stdout.out -errfile stderr.errcat stdout.out cat > > stderr.err > > > > report back the results > > Martin > > > > From: andrew.mar...@exactearth.com > > To: user@commons.apache.org > > Subject: [daemon] > > Date: Thu, 17 Jul 2014 16:24:14 +0000 > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > I'm trying to run a java daemon using jsvc and the Daemon interface. The > > java project is a jar file which has a bunch of dependencies in a manifest > > file (including commons-daemon), and I add this jar file to the classpath > > when running jsvc. > > When I try to execute via jsvc however, I get this stacktrace in stderr: > > > > java.lang.InstantiationException: com.mycomany.mypackage.MyClass > > at java.lang.Class.newInstance(Class.java:359) > > at > > org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190) > > 17/07/2014 17:03:34 9904 jsvc.exec error: Cannot load daemon > > 17/07/2014 17:03:34 9903 jsvc.exec error: Service exit with a return value > > of 3 > > > > Where MyClass is the class that I pass into jsvc. > > > > I have tried using the -verbose option to help diagnose the problem, and > > with that I can see in stdout that it loads all the dependencies from the > > manifest just fine, but no additional information is provided to help > > diagnose the problem. > > Is there a way to get more information about what causes this > > InstantationException? > > > > Best, > > Andrew > > > > > > > > > > > > > > > > > > > > > > > > > > Andrew Martin > > > > > > Software Engineering Co-op, Software Development | exactEarth Ltd. > > > > > > > > > > > > 60 Struck Ct. Cambridge, Ontario N1R 8L2 > > > > > > office. +1.519.622.4445 > > > > > > email. andrew.mar...@exactearth.com > > > > > > > > web. www.exactearth.com > > > > > > > > > > > > > > > > > > > > > > > > > > This e-mail and any attachment is for authorized use by the intended > > recipient(s) only. It contains proprietary or confidential information and > > is not to be copied, disclosed to, retained or used by, any other party. If > > you are not an intended recipient then please promptly delete this e-mail, > > any attachment and all copies and inform the sender. Thank you. > > > > > > > > Andrew Martin > > Software Engineering Co-op, Software Development | exactEarth Ltd. > > 60 Struck Ct. Cambridge, Ontario N1R 8L2 > > office. +1.519.622.4445 > > email. andrew.mar...@exactearth.com > > web. <www.exactearth.com> > > > > > > This e-mail and any attachment is for authorized use by the intended > > recipient(s) only. It contains proprietary or confidential information and > > is not to be copied, disclosed to, retained or used by, any other party. If > > you are not an intended recipient then please promptly delete this e-mail, > > any attachment and all copies and inform the sender. Thank you. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > > For additional commands, e-mail: user-h...@commons.apache.org > > > > > > Andrew Martin > Software Engineering Co-op, Software Development | exactEarth Ltd. > 60 Struck Ct. Cambridge, Ontario N1R 8L2 > office. +1.519.622.4445 > email. andrew.mar...@exactearth.com > web. <www.exactearth.com> > > > This e-mail and any attachment is for authorized use by the intended > recipient(s) only. It contains proprietary or confidential information and is > not to be copied, disclosed to, retained or used by, any other party. If you > are not an intended recipient then please promptly delete this e-mail, any > attachment and all copies and inform the sender. Thank you. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org > For additional commands, e-mail: user-h...@commons.apache.org >