B4J Question jRDC2 & NSSM

swan

Member
Hi guys. I'm using jRDC2 on a remote server (Windows 2016) so I can connect to a MS SQL Server via B4A app. It all works OK except jRDC2 exits after a short period.
It was suggested that jRDC2 be run as a service. Am trying NSSM but I get this message when starting the service - "Unexpected status SERVICE_PAUSED in response to START control".
I'm hoping someone else is using NSSM as it's most likely in the initial setup.
 

OliverA

Expert
Licensed User
Longtime User
Upvote 0

swan

Member
Thanx again, have set Stdout & Stderr on nssm to log files in the path of jRDC2, then stopped the service, OK, then started the service, same error message, but nothing written to either of the log files ?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

swan

Member
Hi and thank you for your patience. I'm sorry I have very little experience with Java (quite obvious I guess). With that batch file, I'm confused to which .jar file it's referring to (somejar.jar). Looking at the jRDC2 dir I see no jar files, however there is a jRDC.exe file. Have I taken the right files across?
Steve ....
 
Upvote 0

swan

Member
Yep, using the same version, thats not a problem.
Just re-capping, what I've done works fine except jRDC2 exits soon after logging out of the VPS.
After compiling jRDC2 which files should I take across to the server ?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
How did you create the exe? Have you tried running it from the command line to see if it runs without errors?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Don't create a exe. Just compile the jRDC2 source in release mode. The .jar file will be located in the Objects folder. Use this .jar file on the server. Install the JDK as located at and instructed at https://www.b4x.com/b4j.html. Since this is not a JavaFX application, other JRE's could be installed. Use the installed JRE to run the jar file.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Open a command prompt, change to the c:\jRDC2 folder and try
B4X:
C:\java\jdk-11.0.1\bin\java.exe -jar jrdc.jar
Note: you may have to adjust the directory in the above command to wherever java.exe is located
If everything works (no errors are displayed. Note: you need to run the test link to see if jRDC2 properly connects to your DB), you should see the output in the prompt. You can stop jRDC2 server with Ctrl+C
If that works, then you can create a batch file in the jRDC2 folder with
B4X:
C:\java\jdk-11.0.1\bin\java.exe -jar jrdc.jar  > stdout.txt 2> stderr.txt
as the content. Test the batch file by running it.
If that works, then proceed to configure nssm to run the batch file for the service
 
Upvote 0

swan

Member
Thanx again. Your instructions were great. Unfortunately my original problem persists. Running the bat file works but after around 20 mins it exits.
Then with nssm same error message - "Unexpected status SERVICE_PAUSED in response to START control".
Tried another app similar to nssm called : "Alwaysup", same error.
I'm starting to doubt if jRDC2 is suitable in this situation. I've come at it now in two different directions ending the same.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Running the bat file works but after around 20 mins it exits.
If that is true, run jrdc from a command prompt without batchfile. Any errors should appear on the console.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…