English 中文(简体)
java 服务包裹,是随着启动失败而逐步建立的根本步骤
原标题:java service wrapper, very basic step by step setup with startup failure

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.

但是,鉴于我非常简单的执行,不能猜测什么是错的。

最佳回答

你们的主要阶层不应扩大WrapperSimpleApp,而是应当实施org.tanukisoftware.wrapper.WrapperListener接口。

You can find a very detailed description about implementing the interface on our website: http://wrapper.tanukisoftware.com/doc/english/integrate-listener.html

请让我知道,你是否在座右铭中就执行情况和(或)组合特性提出进一步问题。

Another advise which comes in handy for me sometimes, is rather than running your application immediately as service, I find it easier to do the integration by running first as console application, because you can see the output directly on your console. Once everything seems working, I go ahead and install/run as service. To run as console application, you would run for example:

C:servicetestin>wrapper -c ../conf/wrapper.conf

你们也可以通过设定目标,转而为强奸者带来减小的产出。

wrapper.debug=true

页: 1

* E/CN.6/2009/1。

如果你的申请实际上像你所描述的那样简单,那么就把你的申请作为普通的 Java申请写成,而没有任何治疗性反应器。

你们可以利用WrapperSimpleApp,将你从箱子中应用,把手法无章地纳入到Wrapper。

你们都需要做的是把以下财产归根到你的账簿中:

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.app.parameter.1=textappender.Main
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../MyProject.jar

有了这一配置,Wrapper将能够作为窗户服务运行。

附录2

我不敢肯定你们的法典究竟是什么样子,但你似乎把WrapperManager.stop()称作你的主要阶层......。

在最初的典型类别之后,我修改了这一类别,因此,它不使用任何Wrapper-API(不需要简单应用):

public class Main {    
public static void main(String[] args) {
    while(true) {
        Logger.getLogger(Main.class.getName()).log(Level.INFO, "I m alive");
        try 
        { Thread.sleep(2000); } 
        catch (java.lang.InterruptedException ex) 
        { return; }
    }
}
}

在汇编和创建“焦炭”之后,conf档案中的必要特性是:

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.app.parameter.1=textappender.Main
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../MyProject.jar

che,

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签