I've searched for an answer and didn't find it, so I hope someone could help. I'd like to wrap with YAJSW a Java Application (the "Starter") that periodically starts and stops a second Java Application (the "Bipper") using the YAJSW functions. As far as I know, if I want to wrap the Starter, I need it to keep running so I can get its PID to use the genConfig.bat command, but my Starter keeps crashing after one restart of the Bipper (The Bipper starts and stops once correctly, then starts again, and then the Starter stops, IDKW). I'm a beginner, so I just don't know how to do it, and get errors which I barely understand. Could you provide me some examples of a working code ? Here is the code of my "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();
}
Here are my logs :
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.
Thanks for any help.