Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EB9EA11CE5 for ; Tue, 22 Apr 2014 17:02:10 +0000 (UTC) Received: (qmail 28665 invoked by uid 500); 22 Apr 2014 17:02:07 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 28558 invoked by uid 500); 22 Apr 2014 17:02:06 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 28550 invoked by uid 99); 22 Apr 2014 17:02:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2014 17:02:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of caspersgrin@gmail.com designates 209.85.160.44 as permitted sender) Received: from [209.85.160.44] (HELO mail-pb0-f44.google.com) (209.85.160.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2014 17:01:59 +0000 Received: by mail-pb0-f44.google.com with SMTP id rp16so5175441pbb.3 for ; Tue, 22 Apr 2014 10:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:date:subject:to:message-id:mime-version; bh=o4Z5maKKPFnyRO4Peu5f8sa1VX7UOixFc0LRD2wEBbA=; b=mnbpaGuXnrhJHMudBrV89zo4UYDBYJR8q0ElwTY3uxA3eeScjFmZ9FsTgUf7gm7ObE Vj4r8jA/hcl8XXNzjIof1b8TzxZI0/aUv+ArPqa4peF524GVULYgbc5XDan6MPmaTo4T xsCXXnxSDO6mOiWD/VBpRqIPH3Z3xETqzEXr7avhPM4GPs1GkOMUd80iNhBFYzsNC4Kd TNrQDqd+g6+aJnCZ+uyy62xFWTwgoPNyF8fWJGF5ywENM627hXa5qqwAcF0tue1RI+dj Qmg7T/DzLYvu0qorBaXshodbb/kMx3XtvPYqvo6u9Zc5f4hdnd9I6EJXhii/SNqCj/Ng 3gaw== X-Received: by 10.66.252.193 with SMTP id zu1mr16874809pac.57.1398186096275; Tue, 22 Apr 2014 10:01:36 -0700 (PDT) Received: from [10.253.7.26] (static-50-53-128-31.bvtn.or.frontiernet.net. [50.53.128.31]) by mx.google.com with ESMTPSA id ha2sm86094321pbb.8.2014.04.22.10.01.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 10:01:35 -0700 (PDT) From: Rob Tanner Content-Type: multipart/alternative; boundary="Apple-Mail=_F357F497-AF9A-41D3-ABE1-6B176EE6CCF2" Date: Tue, 22 Apr 2014 10:01:33 -0700 Subject: Having a problem with jsvc not finding my java class To: user@commons.apache.org Message-Id: <3EA0BC9F-0FEA-4747-B731-D32F38D4BF5A@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) X-Mailer: Apple Mail (2.1874) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_F357F497-AF9A-41D3-ABE1-6B176EE6CCF2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 I=92m trying to daemonize a java class that=92s doing some mail routing = and built jsvc for that purpose. The source I used is from the = commons-daemon-1.0.15-src downloaded from the Apache site, and I=92m = presuming that it=92s good code. I grabbed a Linux style start/stop = script off the web and modified it for my path and class, etc (shown = below). When I run in debug, I can clearly tell that jsvc finds the = commons daemon. But, it can=92t find my class included in = eMailRouter.jar. As far as I can tell, I have the path to the class = correct and I tested it by calling from Java rather than jsvc using this = command: java -cp = /usr/share/java/commons-daemon-1.0.15.jar:/home/rtanner/Java/Workspace/eMa= ilRouter/eMailRouter.jar org.linfield.eMailRouter.RouterDaemon=20 Since I added an otherwise unnecessary main method that simply prints = out =93I=92m in main=94, I was able to confirm that I had found and = executed the class file. My class implements Daemon and at this point = really does nothing more (each of the required methods simply print out = their name). So is it possible that my problem could be the class = itself rather than the start/stop script. Would it help if I posted the = Java source for the class? Immediately below is the start/stop script: #!/bin/sh # Setup variables EXEC=3D/usr/local/bin/jsvc export JAVA_HOME=3D/usr/java/jdk1.7.0_55 export = CLASS_PATH=3D/usr/share/java/commons-daemon-1.0.15.jar:/home/rtanner/Java/= Workspace/eMailRouter/eMailRouter.jar CLASS=3Dorg.linfield.eMailRouter.RouterDaemon USER=3Droot PID=3D/tmp/example.pid LOG_OUT=3D/tmp/example.out LOG_ERR=3D/tmp/example.err do_exec() { $EXEC -debug -home $JAVA_HOME -cp $CLASS_PATH -user $USER -outfile = $LOG_OUT -errfile $LOG_ERR -pidfile $PID $1 $CLASS } pwd echo $CLASS_PATH echo $JAVA_HOME case "$1" in start) do_exec ;; stop) do_exec "-stop" ;; restart) if [ -f $PID ]; then do_exec "-stop" do_exec else echo "service not running, will do nothing" #exit 1 fi ;; *) echo $"usage: daemon {start|stop|restart}" #>&2 exit 3 ## ;; esac exit Thanks. ~ Rob --Apple-Mail=_F357F497-AF9A-41D3-ABE1-6B176EE6CCF2--