B4J Question [ABMaterial] Mini Template Program on Windows VPS

j_o_h_n

Active Member
Licensed User
I can run this properly locally but not on the server.
I don't know exactly how to explain my problem clear in a brief manner so instead I just listed all the steps
I went through below. Sorry that it's a bit long to read.
I'd be very grateful for any advice. Thanks!

Firstly, on my local computer:

1) I compiled the "Mini Template for absolute beginners" in release mode on B4J v8.3.0

2) I then copied the Objects folder from the Template folder of my ABMaterial folder and put it in a folder called C:\Test

3) I killed any Java process that was running (in case this app already running after compilation in release mode(?)

4) Then I ran this instruction on the command line
C:\Java\jdk-11.0.1\bin\java -jar C:\Test\Objects\Template.jar (OpenJDK 11 is in folder C:\Java)

5) I visited "http://localhost:51042/template" in the browser and the app was working properly

Then on the VPS:

On my Windows VPS I also have OpenJDK 11 in folder C:\Java. I visit the VPS using Windows RDP.

6) I uploaded the Objects folder to my Windows VPS and put it in folder C:\Test

7) I ran the same instruction on the command line there C:\Java\jdk-11.0.1\bin\java -jar C:\Test\Objects\Template.jar

8) But on the VPS when I visit "http://localhost:51042/template" in the browser I get just the circles you see in this app when it's loading.
 

Xandoca

Active Member
Licensed User
Longtime User
Could you share/upload template.jar so I can test here in my computer to see if it works? Maybe we got a hint about the problem
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
The command prompt window on the VPS should have your applications logs. Copy and paste the log information here.
 
Upvote 0

Xandoca

Active Member
Licensed User
Longtime User
Did you copy copymewithjar.needs in the same folder as the jar?
Please copy css, font, and js folder from www (project folder) to www in vps and try again.
 
Upvote 0

j_o_h_n

Active Member
Licensed User
Hi Alexandre, thank you but the Template.jar file is too big to process is the message the forum is giving me

Thanks Oliver, text from the command window is below

Microsoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>C:\Java\jdk-11.0.1\bin\java -jar C:\Newfolder\Objects\Template.jar
2020-05-27 14:44:35.274:INFO::main: Logging initialized @1456ms to org.eclipse.jetty.util.log.StdErrLog
loading C:\Users\Administrator: copymewithjar.needs...
Building C:\Users\Administrator\copymewithjar.js.needs
Creating: C:\Users\Administrator\www\js\sessioncreator.js
java.io.FileNotFoundException: C:\Users\Administrator\www\js\sessioncreator.js (The system cannot find the path specified)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
at java.base/java.io.FileWriter.<init>(FileWriter.java:96)
at com.ab.abmaterial.ABMPage.WritePageToDiskPerTheme(Unknown Source)
at com.ab.abmaterial.ABMPage.WritePageToDisk(Unknown Source)
at com.ab.abmaterial.ABMaterial.WritePageToDisk(Unknown Source)
at com.ab.abmaterial.ABMaterial.WriteAppLauchPageToDisk(Unknown Source)
at com.ab.template.abmapplication._startserver(abmapplication.java:354)
at com.ab.template.abmserver._startserver(abmserver.java:413)
at com.ab.template.main._appstart(main.java:79)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:78)
at com.ab.template.main.main(main.java:28)
Building core.min.1590587074727.css...
2020-05-27 14:44:36.024:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
2020-05-27 14:44:36.274:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-05-27 14:44:36.290:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-05-27 14:44:36.290:INFO:eek:ejs.session:main: node0 Scavenging every 660000ms
2020-05-27 14:44:36.321:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@77eca502{/,file:///C:/Users/Administrator/www/,AVAILABLE}
2020-05-27 14:44:36.336:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Users\Administrator\logs\b4j-2020_05_27.request.log
2020-05-27 14:44:36.477:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@4738a206{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 14:44:36.477:INFO:eek:ejs.Server:main: Started @2674ms
2020-05-27 14:44:36.508:INFO:eek:ejs.AbstractConnector:main: Stopped ServerConnector@4738a206{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 14:44:36.508:INFO:eek:ejs.session:main: node0 Stopped scavenging
2020-05-27 14:44:36.524:INFO:eek:ejsh.ContextHandler:main: Stopped o.e.j.s.ServletContextHandler@77eca502{/,file:///C:/Users/Administrator/www/,UNAVAILABLE}
2020-05-27 14:44:36.540:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
2020-05-27 14:44:36.540:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@77eca502{/,file:///C:/Users/Administrator/www/,AVAILABLE}
2020-05-27 14:44:36.555:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Users\Administrator\logs\b4j-2020_05_27.request.log
2020-05-27 14:44:36.555:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-05-27 14:44:36.555:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-05-27 14:44:36.571:INFO:eek:ejs.session:main: node0 Scavenging every 600000ms
2020-05-27 14:44:36.571:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@4738a206{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 14:44:36.571:INFO:eek:ejs.Server:main: Started @2761ms
2020-05-27 14:44:36.571:INFO:eek:ejs.session:main: node0 Scavenging every 450000ms
Redirecting logs to: logs.txt
 
Upvote 0

j_o_h_n

Active Member
Licensed User
Did you copy copymewithjar.needs in the same folder as the jar?
Please copy css, font, and js folder from www (project folder) to www in vps and try again.

Hi Alexandre, I included the copymewithjar.needs.
The www folder has the exact same number of folders, files and is the exact same size on the server as on my computer.
I think I am putting stuff in the wrong place somehow, I'm just copying the objects folder, the one that contains the jar file and the www folder etc.
 
Upvote 0

Xandoca

Active Member
Licensed User
Longtime User
Hi Alexandre, I included the copymewithjar.needs.
The www folder has the exact same number of folders, files and is the exact same size on the server as on my computer.
I think I am putting stuff in the wrong place somehow, I'm just copying the objects folder, the one that contains the jar file and the www folder etc.
Hum... It seems that jar is looking for files in other folder.
B4X:
C:\Users\Administrator>C:\Java\jdk-11.0.1\bin\java -jar C:\Newfolder\Objects\Template.jar
2020-05-27 14:44:35.274:INFO::main: Logging initialized @1456ms to org.eclipse.jetty.util.log.StdErrLog
loading C:\Users\Administrator: copymewithjar.needs...
Building C:\Users\Administrator\copymewithjar.js.needs
Creating: C:\Users\Administrator\www\js\sessioncreator.js

Try execute the jar from C:\Newfolder\Objects
 
Upvote 0

j_o_h_n

Active Member
Licensed User
Try execute the jar from C:\Newfolder\Objects

You guys are brilliant!
Took me a while to figure out what you meant but I think I got there eventually, it works!
(I hadn't realised that where the command prompt was situated made any difference if you used absolute paths.)
Actually the program works better over the internet than locally on the server where the "hello yourname" message doesn't appear.
Over the internet it works perfectly

Without the help you give here, I'd be nowhere with this. Thanks very much.

Microsoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Administrator>cd\
C:\>cd newfolder
C:\Newfolder>cd objects
C:\Newfolder\Objects>C:\Java\jdk-11.0.1\bin\java -jar Template.jar
2020-05-27 15:52:54.189:INFO::main: Logging initialized @1057ms to org.eclipse.jetty.util.log.StdErrLog
loading C:\Newfolder\Objects: copymewithjar.needs...
Using cache system: 3.0
Needs material/awesome icons
Building C:\Newfolder\Objects\copymewithjar.js.needs
Building core.min.1590591173720.css...
2020-05-27 15:52:54.954:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
2020-05-27 15:52:55.111:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-05-27 15:52:55.111:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-05-27 15:52:55.111:INFO:eek:ejs.session:main: node0 Scavenging every 600000ms
2020-05-27 15:52:55.142:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@3246fb96{/,file:///C:/Newfolder/Objects/www/,AVAILABLE}
2020-05-27 15:52:55.142:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Newfolder\Objects\logs\b4j-2020_05_27.request.log
2020-05-27 15:52:55.282:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@135da2ea{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 15:52:55.298:INFO:eek:ejs.Server:main: Started @2167ms
2020-05-27 15:52:55.329:INFO:eek:ejs.AbstractConnector:main: Stopped ServerConnector@135da2ea{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 15:52:55.329:INFO:eek:ejs.session:main: node0 Stopped scavenging
2020-05-27 15:52:55.329:INFO:eek:ejsh.ContextHandler:main: Stopped o.e.j.s.ServletContextHandler@3246fb96{/,file:///C:/Newfolder/Objects/www/,UNAVAILABLE}
2020-05-27 15:52:55.345:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 11.0.1+13
2020-05-27 15:52:55.345:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@3246fb96{/,file:///C:/Newfolder/Objects/www/,AVAILABLE}
2020-05-27 15:52:55.345:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened C:\Newfolder\Objects\logs\b4j-2020_05_27.request.log
2020-05-27 15:52:55.345:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2020-05-27 15:52:55.361:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2020-05-27 15:52:55.361:INFO:eek:ejs.session:main: node0 Scavenging every 600000ms
2020-05-27 15:52:55.361:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@135da2ea{HTTP/1.1,[http/1.1]}{0.0.0.0:51042}
2020-05-27 15:52:55.361:INFO:eek:ejs.Server:main: Started @2239ms
2020-05-27 15:52:55.361:INFO:eek:ejs.session:main: node0 Scavenging every 450000ms
Redirecting logs to: logs.txt
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Once you "get" ABM - you got it.

Relative paths are "sometimes", not so relative. (like with images (icons), www, and downloads....
It can differ between WIN and Linux...

Debugging on your dev and running on production is the best way to see / resolve these issues.
I find it rather trivial compared to the other alternatives... I just go with the flow and what works - works...
 
Upvote 0
Top