Installing Windows Service
-
The documentation in the website about the installation of services, particularly for Windows is for previous versions of Mango "Installing services (Mango 3.5.x and lower)" will this method still work with Mango 3.7.7?
Thanks!
-
No, refer mango 3.6 and later for the 3.7 install
This is at least about using adopt jdk
The rest of the windows install is similar except you fire start-mango.bat and not ma-start.bat
https://docs-v3.mango-os.com/linux-installationFox
-
Hi Matt,
Thanks for your answer, would you be so kind to explain a little further? I am not familiar with Linux.Thanks!
Rodrigo -
It was more for understanding the type of AdoptJDK version to use, that and the launcher, that's all.
The rest of windows should be the same.
Let me know what part exactly you are a bit lost with.Fox
-
Hi Matt,
I was referring to Installing Services, if I understand correctly you are talking about the Mango Installation itself, right?
I had no problem installing Mango, I'm talking about the yajsw file to install a service for Mango to autostart with WindowsRodrigo
-
Sorry Rodrigo, I completely missed your question!
Windows I would imagine would be the same. I can't see how that changes.
Apologies, I'm a linux guy hence I assumed you meant with the installation process.
I've just checked my system. all is the same, you should have no issues - sorry for the runaround!Fox
-
No worries!
Thanks for the help Matt!Best,
Rodrigo -
Hi guys,
Still with problems, installing the service i get this error
it says: ""java"" not recognized as an internal or external command, operable program or batch fileI have installed the AdoptOpenJDK
Can you give me a hand?
Thanks!
Rodrigo -
Look up adding java as an environment variable for windows.
It will under advanced in tje system properties panelFox
-
Hi Matt,
Thanks for the help, I have been able to install the service, but it does not work, it starts and stops alone and when is running I can't access mango.
Any thoughts?
Thanks!
Rodrigo -
I have found this in the wrapper at C:\Mango\yajsw\log\wrapper
WARNING|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|YAJSW: yajsw-stable-11.11 WARNING|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|OS : Windows 10/10.0/amd64 WARNING|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|JVM : AdoptOpenJDK/11.0.9/C:\Program Files\AdoptOpenJDK\jdk-11.0.9.11-hotspot/64 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|ahessian jmx service bound to port 15002 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|working dir C:\Mango\bin [null - INFO] 20-11-05 12:29:58 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.start(AbstractWrappedProcess.java:923) org.rzo.yajsw.wrapper.WrappedProcessList.startAll(WrappedProcessList.java:11) org.rzo.yajsw.app.WrapperMainServiceWin$1.run(WrapperMainServiceWin.java:153) java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|started process with pid 7976 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|restart process due to default exit code rule INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|restart internal RUNNING INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:58|stopping process with pid/timeout 7976 45000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:29:59|process exit code: 999 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|working dir C:\Mango\bin [null - INFO] 20-11-05 12:30:04 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.restartInternal(AbstractWrappedProcess.java:2565) org.rzo.yajsw.wrapper.WrappedJavaProcess$2.fire(WrappedJavaProcess.java:557) org.rzo.yajsw.controller.AbstractController.handleListeners(AbstractController.java:108) org.rzo.yajsw.controller.AbstractController.setState(AbstractController.java:146) org.rzo.yajsw.controller.jvm.JVMController$4$1.run(JVMController.java:701) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|started process with pid 9660 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|restart process due to default exit code rule INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|restart internal RUNNING INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:04|stopping process with pid/timeout 9660 45000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:05|process exit code: 999 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:10|working dir C:\Mango\bin [null - INFO] 20-11-05 12:30:10 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.restartInternal(AbstractWrappedProcess.java:2565) org.rzo.yajsw.wrapper.WrappedJavaProcess$2.fire(WrappedJavaProcess.java:557) org.rzo.yajsw.controller.AbstractController.handleListeners(AbstractController.java:108) org.rzo.yajsw.controller.AbstractController.setState(AbstractController.java:146) org.rzo.yajsw.controller.jvm.JVMController$4$1.run(JVMController.java:701) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:10|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:10|started process with pid 8796 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:11|restart process due to default exit code rule INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:11|restart internal RUNNING INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:11|stopping process with pid/timeout 8796 45000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:11|process exit code: 999 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:16|working dir C:\Mango\bin [null - INFO] 20-11-05 12:30:16 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.restartInternal(AbstractWrappedProcess.java:2565) org.rzo.yajsw.wrapper.WrappedJavaProcess$2.fire(WrappedJavaProcess.java:557) org.rzo.yajsw.controller.AbstractController.handleListeners(AbstractController.java:108) org.rzo.yajsw.controller.AbstractController.setState(AbstractController.java:146) org.rzo.yajsw.controller.jvm.JVMController$4$1.run(JVMController.java:701) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:16|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:16|started process with pid 2964 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:17|restart process due to default exit code rule INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:17|restart internal RUNNING INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:17|stopping process with pid/timeout 2964 45000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:17|process exit code: 999 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:22|working dir C:\Mango\bin [null - INFO] 20-11-05 12:30:22 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.restartInternal(AbstractWrappedProcess.java:2565) org.rzo.yajsw.wrapper.WrappedJavaProcess$2.fire(WrappedJavaProcess.java:557) org.rzo.yajsw.controller.AbstractController.handleListeners(AbstractController.java:108) org.rzo.yajsw.controller.AbstractController.setState(AbstractController.java:146) org.rzo.yajsw.controller.jvm.JVMController$4$1.run(JVMController.java:701) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:22|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:22|started process with pid 9584 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:23|restart process due to default exit code rule INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:23|restart internal RUNNING INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:23|stopping process with pid/timeout 9584 45000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:23|process exit code: 999 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|working dir C:\Mango\bin [null - INFO] 20-11-05 12:30:29 Error in createScript scripts/trayMessage.gv Exception in org.rzo.yajsw.log.MyLogger: Could not determine the last modified timestamp of "file:///C:/WINDOWS/system32/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:103) org.rzo.yajsw.script.GroovyScript.<init>(GroovyScript.java:77) org.rzo.yajsw.script.ScriptFactory.createScript(ScriptFactory.java:45) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerScript(AbstractWrappedProcess.java:1853) org.rzo.yajsw.wrapper.AbstractWrappedProcess.getTriggerActions(AbstractWrappedProcess.java:1738) org.rzo.yajsw.wrapper.AbstractWrappedProcess.startInternal(AbstractWrappedProcess.java:1044) org.rzo.yajsw.wrapper.AbstractWrappedProcess.restartInternal(AbstractWrappedProcess.java:2565) org.rzo.yajsw.wrapper.WrappedJavaProcess$2.fire(WrappedJavaProcess.java:557) org.rzo.yajsw.controller.AbstractController.handleListeners(AbstractController.java:108) org.rzo.yajsw.controller.AbstractController.setState(AbstractController.java:146) org.rzo.yajsw.controller.jvm.JVMController$4$1.run(JVMController.java:701) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) java.base/java.lang.Thread.run(Thread.java:834) INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|error initializing script scripts/trayMessage.gv INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|started process with pid 892 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|too many restarts INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|process not in state RUNNING -> Delaying stop INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|calling onStop INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|Win service stop - timeout: 30000 INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|Win service wrapper.control -> stopping application INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|Win service stop - after shutdown INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|Win service stop - before notify INFO|wrapper|Service com.serotonin.m2m2.Main|20-11-05 12:30:29|Win service terminated
-
Looks like a missing file to me
-
javaws.jar is not included in AdoptOpenJDK which is required for YAJSW to work.
-
Thanks Wingnut
-
Thanks Matt / Wingnut
Can you guys elaborate a little on how to fix it?
Best,
Rodrigo -
Hello Rodrigo,
I have found that if you want to run a version of 3.7.7 or lower on Windows as a service your best bet is Installing Oracle JDK 8. I know it doesn't necessarily follow the recommendation's here, but it allows you to run as a service.
https://docs-v3.mango-os.com/installing-java
-
For Mango versions 3.6.x and higher we recommend using the latest version of Adopt OpenJDK.
-
For Mango versions 3.5.x and lower you should use JDK 8 (OpenJDK 8 should work however we primarily tested on Oracle JDK). Older versions of Mango may not work correctly if you use a newer JDK.
-
OpenJDK 8 builds for ARM 32 processors seem to perform extremely poorly, we suggest avoiding this JDK
Another option that I haven't looked into is explained here.
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-service?view=powershell-7 -
-
Wingnut,
You think I should buy an Oracle JDK 8 license?
Best,
Rodrigo -
Hello Rodrigo,
Here is another alternative. This works on windows with AdoptOpenJDK 11.
NSSM - the Non-Sucking Service Manager
-
@wingnut2-0 said in Installing Windows Service:
NSSM - the Non-Sucking Service Manager
I laughed a little too hard at that one
-
hahaha
I will try to use this and get back to you with news.
Thanks guys!
Best,
Rodrigo