B4J Question Which jOkHttpUtils/JServer for old server?

udg

Expert
Licensed User
Longtime User
Hi all,
I'm going to update an old jetty-based service hosted on an old server. Using default (3.04) jOkHttpUtils2 for B4J 10.50 and library Server3 (3.0) results in the following error.
I seem to recall that for older systems I shoulf use an older versione of jOkHttpUtils/JServer but I may be wrong on this.

B4J jar is compiled with these directives
B4X:
Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
    #AdditionalJar: mysql-connector-java-5.1.40-bin.jar
    #AdditionalJar: bcprov-jdk15on-154
    #JavaCompilerPath: 8, C:\Programmi\Java\jdk1.8.0_201\bin\javac.exe
#End Region

The error from the log on the server is
93.70.86.38 - - [14/Jun/2026:06:58:30 +0000] "GET /hello2 HTTP/1.1" 200 29 "-" "okhttp/4.9.0"
93.70.86.38 - - [14/Jun/2026:06:58:30 +0000] "POST /mnog HTTP/1.1" 500 527 "-" "okhttp/4.9.0"
93.70.86.38 - - [14/Jun/2026:06:58:51 +0000] "POST /mnog HTTP/1.1" 500 529 "-" "okhttp/4.9.0"
93.70.86.38 - - [14/Jun/2026:06:59:01 +0000] "POST /mnog HTTP/1.1" 500 527 "-" "okhttp/4.9.0"

Jun 14, 2026 3:19:29 AM com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
Jun 14, 2026 3:19:30 AM com.mchange.v2.c3p0.C3P0Registry
INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
2026-06-14 03:19:30.337:INFO::main: Logging initialized @782ms to org.eclipse.jetty.util.log.StdErrLog
2026-06-14 03:19:30.557:INFO:eek:ejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_312-b07
2026-06-14 03:19:30.627:INFO:eek:ejs.session:main: DefaultSessionIdManager workerName=node0
2026-06-14 03:19:30.627:INFO:eek:ejs.session:main: No SessionScavenger set, using defaults
2026-06-14 03:19:30.631:INFO:eek:ejs.session:main: node0 Scavenging every 660000ms
2026-06-14 03:19:30.643:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@32eebfca{/,file:///opt/udgapps/varius/www/,AVAILABLE}
2026-06-14 03:19:30.649:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened /opt/udgapps/varius/logs/b4j-2026_06_14.request.log
2026-06-14 03:19:30.674:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@10a035a0{HTTP/1.1,[http/1.1]}{0.0.0.0:61235}
2026-06-14 03:19:30.742:INFO:eek:ejus.SslContextFactory:main: x509=X509@24a35978(1,h=[beachbooking.eu, www.beachbooking.eu],w=[]) for SslContextFactory@16f7c8c1[provider=null,keyStore=file:///opt/udgapps/varius/beachbkg.keystore,trustStore=null]
2026-06-14 03:19:30.845:INFO:eek:ejs.AbstractConnector:main: Started ServerConnector@5f71c76a{SSL,[ssl, http/1.1]}{0.0.0.0:62235}
2026-06-14 03:19:30.846:INFO:eek:ejs.Server:main: Started @1291ms
06/14/2026 03:22:11 93.70.86.38 77 14
Jun 14, 2026 3:22:11 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> tvk13abi1inryrci30fd|ba8a1dc, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> tvk13abi1inryrci30fd|ba8a1dc, idleConnectionTestPeriod -> 600, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 1800, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:130)
at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:110)
at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:531)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:291)
at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:151)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:77)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:690)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at anywheresoftware.b4j.object.ConnectionPool.GetConnection(ConnectionPool.java:45)
at eu.dgc.dgcsvc1.dbstuff._ffpiattigetall(dbstuff.java:2684)
at eu.dgc.dgcsvc1.hsync._handle(hsync.java:647)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 37 more
Where row "06/14/2026 03:22:11 93.70.86.38 77 14" shows that the /mnog handler is called regularly and it's asked to execute service 14 by app 77 (this is part of the POST message from the B4A app). Service 14 should select some data from a DB and return a few rows of data.
DB is working, user for DB is correct and both the jetty-base server and the DB are on the same machine (the remote server)
So, what to investigate?


While the B4A app consuming the service receives
B4X:
-- Articoli inizio
ResponseError. Reason: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out., Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /mnog. Reason:
<pre>    java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /mnog. Reason:
<pre>    java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
</body>
</html>
-- Articoli finito

It looks to me that the error happens when executing the pool.GetConnection from the sub in the handler.

ps: on the following days I'll be abroad and so I don't know if I'll be able to connect to the Forum..don't be upset if you miss a prompt reply by me. Sorry.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm pretty sure that your server supports Java 11+, and you should then use the default jServer 4.0 with the included OkHttpUtils library.

However the error is not related to those versions. It indeed fails on Pool.GetConnection which means that the db server isn't running or maybe there is an authentication problem.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
For what I could test before leaving it is indeed an authentication problem with the user used to connect to the running DB. It came from a dump and restore operation so probably something went wrong at that time .

Thank you
 
Upvote 0
Top