B4J Question LoadURL HTTPS - via WebView - com.sun.webkit.network.URLLoader doRun

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends,

I have read this thread where is desribed the solution:

this is the solution
B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://apps.ika.gr/eAccess/")
Wait For JobDone(j As HttpJob)
If j.Success Then
   Log(j.GetString)
End If
j.Release

but I not understand how can I use this solution for open "https" site with webview...
I hope that it is not dumb question,
please very much for help,
thank you
p4ppc
 

petr4ppc

Well-Known Member
Licensed User
Longtime User
Thank you for your answer, Erel,

I am using B4J 7.51

I am using example from the thread and I get:
2020 2:37:56 ODP. com.sun.webkit.network.URLLoader doRun
WARNING: Unexpected error
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:244)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:181)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:163)
at javafx.web/com.sun.webkit.network.URLLoader.sendRequest(URLLoader.java:371)
at javafx.web/com.sun.webkit.network.URLLoader.doRun(URLLoader.java:167)
at javafx.web/com.sun.webkit.network.URLLoader.lambda$run$0(URLLoader.java:132)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.web/com.sun.webkit.network.URLLoader.run(URLLoader.java:131)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

In B4J I see in WebView only white screen - after compile with B4JPackager (Jana 11) , I see the same.
I have tried some steps I found on the forum, for example:
B4X:
SetSystemProperty("jsse.enableSNIExtension", "false")
but it is not usable in my case.

If somebody know, where I am doing mistake, please for advice,
thank you very much
p4ppc
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
If you could post the URL you are trying to connect to (providing it's a public one), it would enable us to try it and seek a solution for you.
 
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear Daestrum.

The LOG result I wrote is output from my B4J. As I wrote in first post, I am using described link:
please Click here
In Mozilla it is not OK
In Chrome it is OK
In WebView it is not OK

Thank you
p4pc
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The problem happens because it uses an old and deprecated SSL protocol.

This code works:
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private WebView1 As WebView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    SetSystemProperty("deployment.security.TLSv1", "true")
    SetSystemProperty("https.protocols", "TLSv1")
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
    WebView1.LoadUrl("https://apps.ika.gr/eAccess/")
End Sub

Based on: https://stackoverflow.com/questions...slexception-received-fatal-alert-close-notify
 
Upvote 0
Top