B4J Question CloudKVS Server service on windows?

techknight

Well-Known Member
Licensed User
Longtime User
I was looking into CloudKVS, I noticed there is an instruction thing on getting it to run as a Daemon on linux which is easy to do.

But what about windows? Is there a way to get the CloudKVS server to run in windows in the background as a service? (kinda like MQTT mosquitto does). Googling shows a couple methods but there are a ton of steps and looks complicated.

Anything easier? Thanks!
 

techknight

Well-Known Member
Licensed User
Longtime User
I tried it. Doesnt work. Says could not start service, did not report error.

Here is my edited bat file:

B4X:
@echo off

setlocal
@rem note that if JVM not found, service 'does not report an error' when startup fails, although event logged
set JVMDIR=C:\Program Files\Java\jre1.8.0_191\bin\server
set JSBINDIR=%CD%
set JSEXE=%JSBINDIR%\JavaService64.exe
set SSBINDIR=%JSBINDIR%

@echo Installing CloudKVS Server service... Press Control-C to abort
@pause
@echo .
%JSEXE% -install CloudKVS %JVMDIR%\jvm.dll -Djava.class.path=%SSBINDIR%\CloudKVS_Server.jar -Xms16M -Xmx32M -start b4j.cloudkvs.server.main -params start memory -out %JSBINDIR%\stdout.log -err %JSBINDIR%\stderr.log -current %JSBINDIR% -manual -description "CloudKVS Service"
@echo .


@echo Starting CloudKVS Server service... Press Control-C to abort
@pause
@echo .
net start CloudKVS
@echo .


@echo End of script
@pause

Found this in the strerr.log file:
B4X:
2018-11-27 11:57:14.361:INFO::main: Logging initialized @166ms to org.eclipse.jetty.util.log.StdErrLog
main._appstart (java line: 84)
java.lang.NumberFormatException: For input string: "start"
    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
    at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
    at java.lang.Double.parseDouble(Unknown Source)
    at b4j.cloudkvs.server.main._appstart(main.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    at b4j.cloudkvs.server.main.main(main.java:29)
 
Upvote 0

techknight

Well-Known Member
Licensed User
Longtime User
Appears it was something in the line -params start memory

Not sure what that was for, but removing it fixed it.
 
Upvote 0
Top