从YAJSWrapped Java应用程序中启动Java应用程序

时间:2017-02-09 10:47:16

标签: java service launcher yajsw

我已经找到了答案并且没有找到答案,所以我希望有人可以提供帮助。 我想用YAJSW包装一个Java应用程序(" Starter"),它使用YAJSW函数定期启动和停止第二个Java应用程序(" Bipper")。据我所知,如果我想要包装Starter,我需要它继续运行所以我可以让它的PID使用genConfig.bat命令,但是我的Starter在Bipper重启一次后继续崩溃(Bipper启动并且一旦正确停止,然后再次启动,然后启动器停止,IDKW)。 我是初学者,所以我不知道该怎么做,并且得到我几乎无法理解的错误。 你能给我一些工作代码的例子吗?这是我的" starter"的代码。 :

    System.setProperty("wrapper.config", "the Bipper wrapper.conf location");
    System.setProperty("wrapper.java.app.mainclass", "the Starter main class"); // system properties overwrite properties in conf file.

    Map configuration = new HashMap();
    WrappedProcess w = (WrappedProcess) WrappedProcessFactory.createProcess(configuration, true);
    // process specific configuration
    w.getLocalConfiguration().setProperty("wrapper.app.parameter.1", "hello");

    while(true){
        // initialise the process
        w.init();
        // start the process
        w.start();
        w.waitFor(4000);
        // stop the process
        w.stop();
    }

以下是我的日志:

févr. 09, 2017 11:40:22 AM org.apache.commons.vfs2.VfsLog info
INFOS: Using "C:\Users\USER\AppData\Local\Temp\vfs_cache" as temporary files store.
java.io.FileNotFoundException: C:\Users\USER\Desktop\?unresolved?\log\wrapper.log.lck (La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at org.rzo.yajsw.log.MyFileHandler.initOutputFiles(MyFileHandler.java:261)
    at org.rzo.yajsw.log.MyFileHandler.init(MyFileHandler.java:184)
    at org.rzo.yajsw.log.MyFileHandler.<init>(MyFileHandler.java:759)
    at org.rzo.yajsw.log.MyFileHandler.<init>(MyFileHandler.java:775)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.getFileHandler(AbstractWrappedProcess.java:1510)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.getWrapperLogger(AbstractWrappedProcess.java:2667)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.getInternalWrapperLogger(AbstractWrappedProcess.java:2677)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.init(AbstractWrappedProcess.java:271)
    at org.rzo.yajsw.wrapper.WrappedJavaProcess.init(WrappedJavaProcess.java:77)
    at org.rzo.yajsw.wrapper.WrappedProcessFactory.createProcess(WrappedProcessFactory.java:49)
    at Main.main(Main.java:51)
WARNING|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:23|YAJSW: yajsw-stable-12.08
WARNING|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:23|OS   : Windows 7/6.1/amd64
WARNING|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:23|JVM  : Oracle Corporation/1.8.0_121/C:\Program Files\Java\jre1.8.0_121/64
WARNING|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:23|error binding port for system tray icon, please check configuration
system.env 45
[null - INFO] 17-02-09 11:40:23 Error in createScript scripts/trayMessage.gv 
Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/Users/USER/projets/DemoStarter/scripts/trayMessage.gv" because it does not exist. 
  org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:165)
  org.rzo.yajsw.script.GroovyScript.getScriptInstance(GroovyScript.java:113)
  org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:86)
  org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:56)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:2049)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1927)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1168)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.start(AbstractWrappedProcess.java:1037)
  Main.main(Main.java:60)
 INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:23|error initializing script scripts/trayMessage.gv
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25|started process with pid 5232
java.io.FileNotFoundException: C:\Users\USER\Desktop\?unresolved?\log\wrapper.log.lck (La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at org.rzo.yajsw.log.MyFileHandler.initOutputFiles(MyFileHandler.java:261)
    at org.rzo.yajsw.log.MyFileHandler.init(MyFileHandler.java:184)
    at org.rzo.yajsw.log.MyFileHandler.<init>(MyFileHandler.java:759)
    at org.rzo.yajsw.log.MyFileHandler.<init>(MyFileHandler.java:775)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.getFileHandler(AbstractWrappedProcess.java:1510)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.getAppLogger(AbstractWrappedProcess.java:1557)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1187)
    at org.rzo.yajsw.wrapper.AbstractWrappedProcess.start(AbstractWrappedProcess.java:1037)
    at Main.main(Main.java:60)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25|java.io.IOException: Descripteur non valide
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.io.FileInputStream.readBytes(Native Method)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.io.FileInputStream.read(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.io.BufferedInputStream.fill(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.io.BufferedInputStream.read(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at org.rzo.yajsw.io.TeeInputStream$Source.run(TeeInputStream.java:234)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25| at java.lang.Thread.run(Unknown Source)
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:25|[INFO] StandardFileSystemManager - Using "C:\Users\USER\AppData\Local\Temp\vfs_cache" as temporary files store.
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:29|stopping process with pid/timeout 5232 45000
INFO|5232/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:29|wrapper manager received stop command
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:30|process exit code: 0
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:30|shutdown wrapper due to exit code rule
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:30|Shutting down Wrapper
system.env 45
[null - INFO] 17-02-09 11:40:30 Error in createScript scripts/trayMessage.gv 
Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/Users/USER/projets/DemoStarter/scripts/trayMessage.gv" because it does not exist. 
  org.apache.commons.vfs2.provider.DefaultFileContent.getLastModifiedTime(DefaultFileContent.java:165)
  org.rzo.yajsw.script.GroovyScript.getScriptInstance(GroovyScript.java:113)
  org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:86)
  org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:56)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:2049)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1927)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1168)
  org.rzo.yajsw.wrapper.AbstractWrappedProcess.start(AbstractWrappedProcess.java:1037)
  Main.main(Main.java:60)
 INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:30|error initializing script scripts/trayMessage.gv
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31|started process with pid 7208
INFO|wrapper|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31|stopping process with pid/timeout 7208 45000
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31|java.io.IOException: Descripteur non valide
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.io.FileInputStream.readBytes(Native Method)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.io.FileInputStream.read(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.io.BufferedInputStream.fill(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.io.BufferedInputStream.read(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at org.rzo.yajsw.io.TeeInputStream$Source.run(TeeInputStream.java:234)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31| at java.lang.Thread.run(Unknown Source)
INFO|7208/0|C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe|17-02-09 11:40:31|[INFO] StandardFileSystemManager - Using "C:\Users\USER\AppData\Local\Temp\vfs_cache" as temporary files store.

感谢您的帮助。

0 个答案:

没有答案