B4J Question [Solved] Strange problem with the CloudKVS-example by Erel

BlueVision

Active Member
Licensed User
Longtime User
I tried the CloudKVS-example Erel made, installed only the B4J-client.
It does not work for me. For making another program work I run my B4J with Java19, maybe this is the reason for this error (but I am not able to step back, this would create problems in the other projects).
As I understand, the example code should write into the SQL-database DB.DB (independing of a server connection available). The database will be created but remains empty and the log shows, that database is not reachable with the loopback-IP just after starting the little program. This is what I get just after starting the program:
B4X:
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
java.net.ConnectException: Failed to connect to /127.0.0.1:51042
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
    at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:175)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:172)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:220)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.net.ConnectException: Connection refused: no further information
    at java.base/sun.nio.ch.Net.pollConnect(Native Method)
    at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
    at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:535)
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:585)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
    at java.base/java.net.Socket.connect(Socket.java:666)
    at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:120)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
    ... 23 more
ResponseError. Reason: java.net.ConnectException: Failed to connect to /127.0.0.1:51042, Response:
Error sending task: java.net.ConnectException: Failed to connect to /127.0.0.1:51042
A click on the colour button or choosing a number will not change the database. The error happens again, program is not crashing.

The following picture shows the database db.db. Created, but untouched...

Any ideas?
 

BlueVision

Active Member
Licensed User
Longtime User
The server is not running (not installed). Independent of that, if it is an asynchronous offline storage for transmitting the data later, it should store the data inside that local database, or am I wrong again?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Server is expected to be always running.
The client can be disconnected and work locally.
It will try to connect to server. If it failed, you can ignore the error.
When it is connected, your data is sent.
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
This is a solution where you want to save the same data store in client to the server.
I know, but 1st step for integration was to built the client-side. It makes no sense to me, that db.db gets not filled with the content to transmit to the server, because it should work offline, independing a server on the client-site.
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Hi Aeric,
Sorry for the late reply.
I don't know why. At least your version works within my home network.

Thank you!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…