B4J Question [SOLVED] B4JPackager11 error javax.net.ssl.SSLHandshakeException

Hendrik Wijaya

Member
Licensed User
Hi,

I build myapplication using java11 (downloaded from this site) and it run well when using java.
When i package myapplication using B4JPackager11, it show error:

D:\B4JPackager11\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/b4j.webapps.main
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at b4j/okhttp3.internal.connection.RealConnection.connectTls(Unknown Source)
at b4j/okhttp3.internal.connection.RealConnection.establishProtocol(Unknown Source)
at b4j/okhttp3.internal.connection.RealConnection.buildConnection(Unknown Source)
at b4j/okhttp3.internal.connection.RealConnection.connect(Unknown Source)
at b4j/okhttp3.internal.connection.StreamAllocation.findConnection(Unknown Source)
at b4j/okhttp3.internal.connection.StreamAllocation.findHealthyConnection(Unknown Source)
at b4j/okhttp3.internal.connection.StreamAllocation.newStream(Unknown Source)
at b4j/okhttp3.internal.connection.ConnectInterceptor.intercept(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.cache.CacheInterceptor.intercept(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.http.BridgeInterceptor.intercept(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source)
at b4j/okhttp3.RealCall.getResponseWithInterceptorChain(Unknown Source)
at b4j/okhttp3.RealCall.execute(Unknown Source)
at b4j/anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(Unknown Source)
at b4j/anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(Unknown Source)
at b4j/anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Suppressed: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
... 37 more
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, Response:
JobName = cekversion, Success = false

I also try to change hc.Initialize to hc.InitializeAcceptAll in HttpUtils2Service. But, it still show this error.


Thanks
 

Hendrik Wijaya

Member
Licensed User
Yes Erel, Cloudflare support TLS 1 to 1.3.
Myapp can run well from "java -jar myapps.jar"
It only shows error when using B4JPackager11.
Here I attach the file for test.


Thanks
 

Attachments

Erel

Administrator
Staff member
Licensed User
Add this module:
B4X:
Private IncludedModules As List = Array("jdk.crypto.ec")
Explanation: https://stackoverflow.com/questions/54770538/received-fatal-alert-handshake-failure-in-jlinked-jre
You can also add it in the json file.

Tip: simplify your program to:
B4X:
Dim v As HttpJob
v.Initialize("",Me)
v.Download(url)
Wait For (v) JobDone(v As HttpJob)
If v.Success Then
   LBL_Info.Text = v.GetString
End If
v.Release
And you should also use jOkHttpUtils2 library instead of the modules.
 
Top