I have simply donwloaded JSW community edition, unwrapped into a directory:
c:servicetest
So here i have a bin, conf, lib 以及log subdirs, among others.
From now on this will be (root).
I referenced the (root)/lib/wrapper.jar into my ide (netbeans) 以及create a very simple service (remember the class name is Main):
public class Main extends WrapperSimpleApp {
public Main(String[] args) {
super(args);
}
@Override
public void run() {
while(true) {
Logger.getLogger(Main.class.getName()).log(Level.INFO, "I m alive");
try
{ Thread.sleep(2000); }
catch (InterruptedException ex)
{ return; }
}
}
}
如你所看到的那样,它基本上只是传递信息。 但实际上,这既不是开始的。
我汇编了该项目(My Project.jar),将杰尔编为(root)名录,并修改了(root)/config/wrapper。
wrapper.java.classpath.3=../MyProject.jar
以及
wrapper.java.mainclass=textappender.Main
Then i ve installed the service in comm以及line, with:
C:servicetestin>wrapper -i ../conf/wrapper.conf
然后,一夫通过服务开始服务。 监控小组或
C:servicetestin>wrapper -t ../conf/wrapper.conf
在记录/记录中,i 得到:
ERROR | wrapper | 2012/05/21 21:35:11 | JVM exited while loading the application.
UPDATE 1
之后 Tanuki 软件咨询,即我(root)/config/wrapper.conf(自那时起,已无结果):
wrapper.debug=TRUE
现在我这样做:
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: WrapperManager.stop(1) called by thread: main
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Backend not connected, not sending packet STOP : 1
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Stopped checking for control events.
DEBUG | wrapper | 2012/05/22 10:46:37 | Pause reading child process output to share cycles.
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Thread, main, handling the shutdown process.
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: shutdownJVM(1) Thread: main
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: wait for 0 shutdown locks to be released.
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: Backend not connected, not sending packet STOPPED : 1
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: calling System.exit(1)
DEBUG | wrapper | 2012/05/22 10:46:38 | JVM process exited with a code of 1, setting the wrapper exit code to 1.
但是,鉴于我非常简单的执行,不能猜测什么是错的。