B4J Tutorial [ABMaterial][BANano] Issue(s) with developing in both

OliverA

Expert
Licensed User
First post, first issue:
I'm in the process of developing an ABM application. For testing purposes, I uploaded the application on my test server. The application may start fine, but when loading another page, the enabled loading animation will load continuously. Server's log shows following entries:
Waiting for value (3 ms)
Waiting for value (1 ms)
Disconnected
/service-worker.js
Not Found
Connected
Waiting for value (28 ms)
Waiting for value (8 ms)
Disconnected
Connected
Waiting for value (2 ms)
Waiting for value (1 ms)
Disconnected
Connected
Waiting for value (2 ms)
Waiting for value (1 ms)
Disconnected
/service-worker.js
Not Found
Connected
Waiting for value (2 ms)
Waiting for value (1 ms)
in a repetitive manner. Now and then, the application will suddenly show the page until another page needs to be shown and the process starts over. Looking at Firefox's log one sees
Failed to register/update a ServiceWorker for scope ‘https://xxxxxx.xxxxxxx.xxx/’: Load failed with status 404 for script ‘https://xxxxxx.xxxxxxx.xxx/service-worker.js’.
Huh?
I tried another browser, Chrome. Chrome just kept looping through this
b4j_raiseEvent @ VM2628 core.4.38.min.js:1
(anonymous) @ VM2629 xxxxxxxxx.1560175082433.js:17
(anonymous) @ VM2629 xxxxxxxxx.1560175082433.js:17
Navigated to https://xxxxxx.xxxxxxx.xxx/xxxxxxxxx/
VM2633 xxxxxxxxx.1560175082433.js:29 ready to connect the websocket
VM2632 core.4.38.min.js:1 Using RobustWebSocket
VM2632 core.4.38.min.js:1 WebSocket opened, reconnected?: false
VM2632 core.4.38.min.js:1 Stop reconnecting: 1000,false
VM2632 core.4.38.min.js:1 closed - navigator.onLine:true
VM2632 core.4.38.min.js:1 Connection is closed. Trying to reconnect.
b4j_raiseEvent @ VM2632 core.4.38.min.js:1
(anonymous) @ VM2633 xxxxxxxxx.1560175082433.js:17
(anonymous) @ VM2633 xxxxxxxxx.1560175082433.js:17
Navigated to https:////xxxxxx.xxxxxxx.xxx/xxxxxxxxx/
VM2637 xxxxxxxxx.1560175082433.js:29 ready to connect the websocket
VM2636 core.4.38.min.js:1 Using RobustWebSocket
VM2636 core.4.38.min.js:1 WebSocket opened, reconnected?: false
VM2636 core.4.38.min.js:1 Stop reconnecting: 1000,false
VM2636 core.4.38.min.js:1 closed - navigator.onLine:true
VM2636 core.4.38.min.js:1 Connection is closed. Trying to reconnect.
I changed ports on ABM project and voila everything is fine. Hm. While testing Chrome, I noticed that Chrome fired up a previous web page I had served from the same server that was created using BANano. Strange. I thought I stopped that server. After poking around the server for a good hour, including several reboots to see if I can stop this phantom server, nothing was achieved, nothing changed. Ports on ABM project were change to something else and suddenly everything works. Weird. Is something else using up ports 80 and 443 on the server? Checked again. Rebooted again. No. Changed ports back to 80 and 443 on ABM project. Both Firefox and Chrome produced the previous erroneous results. Finally, I try a third browser, Edge. Everything works. What? A light goes off. I previously worked on a BANano project that I served from the same server I am testing the ABM project on. I cleared the cache of both Firefox and Chrome and voila, everything is up and running. Except that I lost my morning on this. Something (installing ABM app with SSL cert) that I thought would be a 15-minute exercise turned into an adventure.

Lesson learned: When switching between ABMaterial and BANano development, clear the browsers cache! Why am I posting this? So, in case someone else runs into this. Hopefully the log entries above point them to this forum entry (and therefore keep someone from wasting hours in figuring out what the heck is going on).

Update#1: In Chrome, clearing the Data cache did the trick. For Firefox, both the Data cache and the Cookies had to be cleared. Ugh.

In case there are other issues that one runs into while developing for both frameworks, feel free to post your experience(s) and solution(s) here.
 
Last edited:

alwaysbusy

Expert
Licensed User
When using a service-worker in BANano, this is indeed something you have to be aware of. A service worker is a very powerful object that caches 'everything' so the whole website/webapp can work, even offline.

This does result that e.g. if you work on port 80, and you have used a service-worker, you can get weird results like you describe when going to the same path (in ABM or BANano).

So checking which service workers that are installed (and maybe unregistering it if needed) may also be needed:

upload_2019-6-11_16-9-37.png
 
Top