6

commons-daemon-x.jarclasspath. Jsvc正在成功启动 Java VM。但是jsvc报告它无法找到守护程序加载程序类,即使它位于classpath.

有谁知道如何解决这个问题?我正在运行 Mac OS X 10.8.3。谢谢。

jsvc这是调试输出的摘录:

...    
+-- 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
...

如果有帮助,这是完整的调试输出:

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

2 回答 2

15

您现在可能已经找到了解决方案,但以防万一将来有人偶然发现,我错过的是当前目录默认为“/”,因此如果您想使用相对路径,则必须指定它。

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

注意:我的操作系统是 ubuntu 12.10

于 2014-02-04T14:45:57.083 回答
-1

检查commons-daemon-1.0.15.jar文件的权限,确保您的当前用户可以读取它。

于 2013-05-09T14:01:40.303 回答