Sarge516
asked on
jsvc.exec error: Cannot found Daemon Loader "version" entry point
OS Centos 6
commons-daemon-1.0.7.jar
I'm trying to use jsvc for the first time to help auto run a java program. My program has the required methods (start(), etc. listed in the jsvc home web page.
I run as -debug and get the error listed in the title.
This is not related to running Tomcat, although I do have tomcat 6 installed and running. My classpath is auto created based on what jars are in my dir so I have not forced any jar ordering yet.
My Script is something like this :
JAVA_HOME=/usr/lib/jvm/jre -1.6.0-ope njdk.x86_6 4
export JAVA_HOME
appdir=/opt/YOYO
myJars=`find $appdir *.jar`
for i in $myJars; do
echo $i
clp=$clp:$i
done
echo $clp
/usr/bin/jsvc -cp $clp -version -debug org.yoyol.v01_02.Server.Ru n.RunMe
So my question is what is needed to fix the missing "version" entry point ?
Thanks,
Sarge
commons-daemon-1.0.7.jar
I'm trying to use jsvc for the first time to help auto run a java program. My program has the required methods (start(), etc. listed in the jsvc home web page.
I run as -debug and get the error listed in the title.
This is not related to running Tomcat, although I do have tomcat 6 installed and running. My classpath is auto created based on what jars are in my dir so I have not forced any jar ordering yet.
My Script is something like this :
JAVA_HOME=/usr/lib/jvm/jre
export JAVA_HOME
appdir=/opt/YOYO
myJars=`find $appdir *.jar`
for i in $myJars; do
echo $i
clp=$clp:$i
done
echo $clp
/usr/bin/jsvc -cp $clp -version -debug org.yoyol.v01_02.Server.Ru
So my question is what is needed to fix the missing "version" entry point ?
Thanks,
Sarge
ASKER
That certainly cleans up the classpath which is good. However, I still get the same error.
To confirm the classpath is correct, I can replacing the jsvs line with the one below and it works - but interactively ..
java -cp $clp -jar MyApp.jar
To confirm the classpath is correct, I can replacing the jsvs line with the one below and it works - but interactively ..
java -cp $clp -jar MyApp.jar
Try putting in -debug and see what happens
The daemon classes themselves have to be in the classpath too afaik
ASKER
Here is the result of the debug. The commons-daemon is in the classpath. The Daemon load shows found.
05/11/2011 14:07:00 6358 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
05/11/2011 14:07:00 6358 jsvc.exec debug: | Version: 10004
05/11/2011 14:07:00 6358 jsvc.exec debug: | Ignore Unrecognized Arguments: False
05/11/2011 14:07:00 6358 jsvc.exec debug: | Extra options: 2
05/11/2011 14:07:00 6358 jsvc.exec debug: | "-Djava.class.path=:/opt/Y OYO/common s-lang-2.1 .jar:/opt/ YOYO/mysql -connector -java-5.1. 6-bin.jar: /opt/YOYO/ YOYOServer .jar:/opt/ YOYO/mail. jar:/opt/Y OYO/YOYO_I nterfaces. jar:/opt/Y OYO/common s-daemon-1 .0.7.jar:- 0.91.jar:/ opt/YOYO/l og4j-1.2.1 4.jar
05/11/2011 14:07:00 6358 jsvc.exec debug: +------------------------- ---------- ---------- ----------
05/11/2011 14:07:00 6358 jsvc.exec debug: Java VM created successfully
05/11/2011 14:07:00 6358 jsvc.exec debug: Class org/apache/commons/daemon/ support/Da emonLoader found
05/11/2011 14:07:00 6358 jsvc.exec debug: Native methods registered
05/11/2011 14:07:00 6358 jsvc.exec error: Cannot found Daemon Loader "version" entry point
05/11/2011 14:07:00 6357 jsvc.exec error: Service exit with a return value of 255
05/11/2011 14:07:00 6358 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
05/11/2011 14:07:00 6358 jsvc.exec debug: | Version: 10004
05/11/2011 14:07:00 6358 jsvc.exec debug: | Ignore Unrecognized Arguments: False
05/11/2011 14:07:00 6358 jsvc.exec debug: | Extra options: 2
05/11/2011 14:07:00 6358 jsvc.exec debug: | "-Djava.class.path=:/opt/Y
05/11/2011 14:07:00 6358 jsvc.exec debug: +-------------------------
05/11/2011 14:07:00 6358 jsvc.exec debug: Java VM created successfully
05/11/2011 14:07:00 6358 jsvc.exec debug: Class org/apache/commons/daemon/
05/11/2011 14:07:00 6358 jsvc.exec debug: Native methods registered
05/11/2011 14:07:00 6358 jsvc.exec error: Cannot found Daemon Loader "version" entry point
05/11/2011 14:07:00 6357 jsvc.exec error: Service exit with a return value of 255
ASKER
Also, MyApp.jar is in the classpath. I'm trying to simply what I'm posting.
Your classpath is somewhat mangled. Look at the last entry
/opt/YOYO/commons-lang-2.1.jar
/opt/YOYO/mysql-connector-java-5.1.6-bin.jar
/opt/YOYO/YOYOServer.jar
/opt/YOYO/mail.jar
/opt/YOYO/YOYO_Interfaces.jar
/opt/YOYO/commons-daemon-1.0.7.jar
-0.91.jar
I missed the last actual entry out accidentally but at least it draws attention to a problem
In fact you can simplify that with the following (the quotes are essential)
/usr/bin/jsvc -cp '/opt/YOYO/*.jar' -version -debug org.yoyol.v01_02.Server.Run.RunMe
ASKER
Team,
I appreciate the help but the mangled classpath was a cut/paste problem that I did. The classpath seems to be OK. I've been trying many things now but still get the issue. Here is the last of the debug log.
06/11/2011 14:40:15 10625 jsvc.exec debug: +-- DUMPING JAVA HOME STRUCTURE ------------------------
06/11/2011 14:40:15 10625 jsvc.exec debug: | Java Home: "/usr/lib/jvm/jre-1.6.0-op enjdk.x86_ 64"
06/11/2011 14:40:15 10625 jsvc.exec debug: | Java VM Config.: "/usr/lib/jvm/jre-1.6.0-op enjdk.x86_ 64/lib/amd 64/jvm.cfg "
06/11/2011 14:40:15 10625 jsvc.exec debug: | Found JVMs: 1
06/11/2011 14:40:15 10625 jsvc.exec debug: | JVM Name: "server"
06/11/2011 14:40:15 10625 jsvc.exec debug: | "/usr/lib/jvm/jre-1.6.0-op enjdk.x86_ 64/lib/amd 64/server/ libjvm.so"
06/11/2011 14:40:15 10625 jsvc.exec debug: +------------------------- ---------- ---------- ----------
06/11/2011 14:40:15 10625 jsvc.exec debug: Running w/ LD_LIBRARY_PATH=/usr/lib/j vm/jre-1.6 .0-openjdk .x86_64/li b/amd64/se rver:/usr/ lib/jvm/jr e-1.6.0-op enjdk.x86_ 64/lib/amd 64
06/11/2011 14:40:15 10625 jsvc.exec debug: redirecting stdout to /dev/null and stderr to /dev/null
06/11/2011 14:40:15 10626 jsvc.exec debug: Using default JVM in /usr/lib/jvm/jre-1.6.0-ope njdk.x86_6 4/lib/amd6 4/server/l ibjvm.so
06/11/2011 14:40:15 10626 jsvc.exec debug: Attemtping to load library /usr/lib/jvm/jre-1.6.0-ope njdk.x86_6 4/lib/amd6 4/server/l ibjvm.so
06/11/2011 14:40:15 10626 jsvc.exec debug: JVM library /usr/lib/jvm/jre-1.6.0-ope njdk.x86_6 4/lib/amd6 4/server/l ibjvm.so loaded
06/11/2011 14:40:15 10626 jsvc.exec debug: JVM library entry point found (0x244E3C90)
06/11/2011 14:40:15 10626 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
06/11/2011 14:40:15 10626 jsvc.exec debug: | Version: 10004
06/11/2011 14:40:15 10626 jsvc.exec debug: | Ignore Unrecognized Arguments: False
06/11/2011 14:40:15 10626 jsvc.exec debug: | Extra options: 2
06/11/2011 14:40:15 10626 jsvc.exec debug: | "-Djava.class.path=:/opt/Y OYO/common s-lang-2.1 .jar:/opt/ YOYO/mysql -connector -java-5.1. 6-bin.jar: /opt/YOYO/ YOYOServer .jar:/opt/ YOYO/mail. jar:/opt/Y OYO/activa tion.jar:/ opt/YOYO/Y OYO_Interf aces.jar:/ opt/YOYO/c ommons-dae mon-1.0.7. jar:/opt/Y OYO/log4j- 1.2.14.jar :/opt/YOYO /Mesp.jar" (0x00000000)
06/11/2011 14:40:15 10626 jsvc.exec debug: +------------------------- ---------- ---------- ----------
06/11/2011 14:40:15 10626 jsvc.exec debug: Java VM created successfully
06/11/2011 14:40:15 10626 jsvc.exec debug: Class org/apache/commons/daemon/ support/Da emonLoader found
06/11/2011 14:40:15 10626 jsvc.exec debug: Native methods registered
06/11/2011 14:40:15 10626 jsvc.exec error: Cannot found Daemon Loader "version" entry point
06/11/2011 14:40:15 10625 jsvc.exec error: Service exit with a return value of 255
Not sure why DaemonLoader is found but missing "version entry point".
Any help with the entry point issue would be appreciated.
I appreciate the help but the mangled classpath was a cut/paste problem that I did. The classpath seems to be OK. I've been trying many things now but still get the issue. Here is the last of the debug log.
06/11/2011 14:40:15 10625 jsvc.exec debug: +-- DUMPING JAVA HOME STRUCTURE ------------------------
06/11/2011 14:40:15 10625 jsvc.exec debug: | Java Home: "/usr/lib/jvm/jre-1.6.0-op
06/11/2011 14:40:15 10625 jsvc.exec debug: | Java VM Config.: "/usr/lib/jvm/jre-1.6.0-op
06/11/2011 14:40:15 10625 jsvc.exec debug: | Found JVMs: 1
06/11/2011 14:40:15 10625 jsvc.exec debug: | JVM Name: "server"
06/11/2011 14:40:15 10625 jsvc.exec debug: | "/usr/lib/jvm/jre-1.6.0-op
06/11/2011 14:40:15 10625 jsvc.exec debug: +-------------------------
06/11/2011 14:40:15 10625 jsvc.exec debug: Running w/ LD_LIBRARY_PATH=/usr/lib/j
06/11/2011 14:40:15 10625 jsvc.exec debug: redirecting stdout to /dev/null and stderr to /dev/null
06/11/2011 14:40:15 10626 jsvc.exec debug: Using default JVM in /usr/lib/jvm/jre-1.6.0-ope
06/11/2011 14:40:15 10626 jsvc.exec debug: Attemtping to load library /usr/lib/jvm/jre-1.6.0-ope
06/11/2011 14:40:15 10626 jsvc.exec debug: JVM library /usr/lib/jvm/jre-1.6.0-ope
06/11/2011 14:40:15 10626 jsvc.exec debug: JVM library entry point found (0x244E3C90)
06/11/2011 14:40:15 10626 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
06/11/2011 14:40:15 10626 jsvc.exec debug: | Version: 10004
06/11/2011 14:40:15 10626 jsvc.exec debug: | Ignore Unrecognized Arguments: False
06/11/2011 14:40:15 10626 jsvc.exec debug: | Extra options: 2
06/11/2011 14:40:15 10626 jsvc.exec debug: | "-Djava.class.path=:/opt/Y
06/11/2011 14:40:15 10626 jsvc.exec debug: +-------------------------
06/11/2011 14:40:15 10626 jsvc.exec debug: Java VM created successfully
06/11/2011 14:40:15 10626 jsvc.exec debug: Class org/apache/commons/daemon/
06/11/2011 14:40:15 10626 jsvc.exec debug: Native methods registered
06/11/2011 14:40:15 10626 jsvc.exec error: Cannot found Daemon Loader "version" entry point
06/11/2011 14:40:15 10625 jsvc.exec error: Service exit with a return value of 255
Not sure why DaemonLoader is found but missing "version entry point".
Any help with the entry point issue would be appreciated.
ASKER
Ok, I'm scaled down it way and I still get the Cannot found Daemon Loader "version" entry point
Test code is attached. Is it complete ?
I've tested against the commons-deamon-1.0.5 and 1.0.7 jar versions.
I've change my JRE to be the Oracle Linux instead of Icetea.
What am I missing ? Does anyone else run jsvc with success ?
Thanks.
Error is now
08/11/2011 12:33:00 3731 jsvc.exec debug: Using default JVM in /opt/java/jre1.6.0_29/lib/ amd64/serv er/libjvm. so
08/11/2011 12:33:00 3731 jsvc.exec debug: Attemtping to load library /opt/java/jre1.6.0_29/lib/ amd64/serv er/libjvm. so
08/11/2011 12:33:00 3731 jsvc.exec debug: JVM library /opt/java/jre1.6.0_29/lib/ amd64/serv er/libjvm. so loaded
08/11/2011 12:33:00 3731 jsvc.exec debug: JVM library entry point found (0x8C11E570)
08/11/2011 12:33:00 3731 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
08/11/2011 12:33:00 3731 jsvc.exec debug: | Version: 10004
08/11/2011 12:33:00 3731 jsvc.exec debug: | Ignore Unrecognized Arguments: False
08/11/2011 12:33:00 3731 jsvc.exec debug: | Extra options: 2
08/11/2011 12:33:00 3731 jsvc.exec debug: | "-Djava.class.path=:/opt/j svct1/comm ons-daemon -1.0.5.jar :/opt/jsvc t1/testme. jar" (0x00000000)
08/11/2011 12:33:00 3731 jsvc.exec debug: +------------------------- ---------- ---------- ----------
08/11/2011 12:33:00 3731 jsvc.exec debug: Java VM created successfully
08/11/2011 12:33:00 3731 jsvc.exec debug: Class org/apache/commons/daemon/ support/Da emonLoader found
08/11/2011 12:33:00 3731 jsvc.exec debug: Native methods registered
08/11/2011 12:33:00 3731 jsvc.exec error: Cannot found Daemon Loader "version" entry point
08/11/2011 12:33:00 3730 jsvc.exec error: Service exit with a return value of 255
Test code is attached. Is it complete ?
I've tested against the commons-deamon-1.0.5 and 1.0.7 jar versions.
I've change my JRE to be the Oracle Linux instead of Icetea.
What am I missing ? Does anyone else run jsvc with success ?
Thanks.
Error is now
08/11/2011 12:33:00 3731 jsvc.exec debug: Using default JVM in /opt/java/jre1.6.0_29/lib/
08/11/2011 12:33:00 3731 jsvc.exec debug: Attemtping to load library /opt/java/jre1.6.0_29/lib/
08/11/2011 12:33:00 3731 jsvc.exec debug: JVM library /opt/java/jre1.6.0_29/lib/
08/11/2011 12:33:00 3731 jsvc.exec debug: JVM library entry point found (0x8C11E570)
08/11/2011 12:33:00 3731 jsvc.exec debug: +-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
08/11/2011 12:33:00 3731 jsvc.exec debug: | Version: 10004
08/11/2011 12:33:00 3731 jsvc.exec debug: | Ignore Unrecognized Arguments: False
08/11/2011 12:33:00 3731 jsvc.exec debug: | Extra options: 2
08/11/2011 12:33:00 3731 jsvc.exec debug: | "-Djava.class.path=:/opt/j
08/11/2011 12:33:00 3731 jsvc.exec debug: +-------------------------
08/11/2011 12:33:00 3731 jsvc.exec debug: Java VM created successfully
08/11/2011 12:33:00 3731 jsvc.exec debug: Class org/apache/commons/daemon/
08/11/2011 12:33:00 3731 jsvc.exec debug: Native methods registered
08/11/2011 12:33:00 3731 jsvc.exec error: Cannot found Daemon Loader "version" entry point
08/11/2011 12:33:00 3730 jsvc.exec error: Service exit with a return value of 255
package test1;
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonInitException;
public class RunDaemon implements Daemon {
RunMe rm = null;
@Override
public void destroy() {
//rm = null;
}
@Override
public void init(DaemonContext arg0) throws DaemonInitException, Exception {
rm = new RunMe();
}
@Override
public void start() throws Exception {
rm.myStart();
}
@Override
public void stop() throws Exception {
rm.myStop();
}
}
package test1;
import java.util.Date;
public class RunMe {
boolean stopme = false;
Date startDate = new Date();
Date endDate = startDate;
public void myStart() {
startDate = new Date();
while (false == stopme)
{
// System.out.println(new Date());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
endDate = new Date();
System.out.println("END OF PROGRAM");
}
public void myStop() {
System.out.println("MyStop");
stopme = true;
}
public void status() {
System.out.println("Start Date = "+startDate);
System.out.println("End Date = "+endDate);
}
}
I'll give it a try with Sun Java if i can
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
My problem was related to the -version option in the run line. "-version" shows to be a valid option under jsvc but was the reason the code could not start.
The javadoc http://commons.apache.org/daemon/apidocs/index.html refers to the version method, but not much is mentioned.
[root@bmMail001 BMO]# /usr/bin/jsvc --help
Usage: jsvc [-options] class [args...]
Where options include:
-jvm <JVM name>
use a specific Java Virtual Machine. Available JVMs:
'server'
-cp / -classpath <directories and zip/jar files>
set search path for service classes and resouces
-home <directory>
set the path of your JDK or JRE installation (or set
the JAVA_HOME environment variable)
-version
show the current Java environment version (to check
correctness of -home and -jvm. Implies -nodetach)
-help / -?
show this help page (implies -nodetach)
The javadoc http://commons.apache.org/daemon/apidocs/index.html refers to the version method, but not much is mentioned.
[root@bmMail001 BMO]# /usr/bin/jsvc --help
Usage: jsvc [-options] class [args...]
Where options include:
-jvm <JVM name>
use a specific Java Virtual Machine. Available JVMs:
'server'
-cp / -classpath <directories and zip/jar files>
set search path for service classes and resouces
-home <directory>
set the path of your JDK or JRE installation (or set
the JAVA_HOME environment variable)
-version
show the current Java environment version (to check
correctness of -home and -jvm. Implies -nodetach)
-help / -?
show this help page (implies -nodetach)
Anyway i can tell you why "Cannot found Daemon Loader "version" entry point" happens, but can't explain it. It happens when it can't get that static method via a jni call:
http://svn.apache.org/repos/asf/commons/proper/daemon/trunk/src/native/unix/native/java.c
Apart from having the same problem with using the -version parameter, i can manage to run your code ok with jsvc
http://svn.apache.org/repos/asf/commons/proper/daemon/trunk/src/native/unix/native/java.c
Apart from having the same problem with using the -version parameter, i can manage to run your code ok with jsvc
looks suspect. Try the following and if that doesn't work, pass the -debug argument to jsvc
Open in new window