B4J Question [Solved] Problem with WebView and Integrated B4JPackager11

bdunkleysmith

Active Member
Licensed User
Longtime User
I have a legacy project in which the main form and a modal form (for displaying a help screen) were designed in Scene Builder. Both contain WebViews. Being first developed under Java 8, I used Launch4j to produce the executable.

However I had to make a minor update and having now moved to Java 11 for all projects, while it continues to work in Release mode in the IDE, I found that the WebView in the main form is not functioning correctly when I use the integrated packager even though I've added #PackagerProperty: IncludedModules = javafx.web

Here is the relevant code:

B4X:
Sub AppStart (Form1 As Form, Args() As String)       
        MainForm = Form1
        MainForm.RootPane.LoadLayout("LiveStatsV1") 'Load the layout file.
        MainForm.Title = "LiveStats Analysis " & Ver
        MainForm.Icon = fx.LoadImage(File.DirAssets,"BDSConsulting.png")
        we.InitializeNewInstance("javafx.scene.web.WebEngine",Null)
        Temp = wv1
        we = Temp.RunMethod("getEngine",Null)
        wv1.Enabled = True
        wv1.Visible = True
        tv2.Visible = False
        BrowserURLText.text = "http://"
        we.RunMethod("load",Array As Object(startPage))
        MainForm.Show
        progInd.Visible = True
End Sub

Sub wv1_PageFinished (Url As String)
        If Url.Contains("www.fibalivestats.com") Then
            Dim start As Long = sf.InString(Url, "u/")
            Dim right As Long = sf.Len(Url)
            right = right - start  - 2
            Dim partUrl As String = sf.Right(Url, right)
            Dim slash As Long = sf.InString(partUrl, "/")
            Dim code As String = sf.Mid(Url, start + 1, slash + 2)
            URLText.Text = Url.Replace(code,"data")
        End If
    BrowserURLText.Text = Url 'Display URL of page loaded in browser
    progInd.Visible = False
End Sub

In Release mode in the IDE the startpage is displayed in the wv1 WebView in the main form and the PageFinished event must be triggered because the URL test is displayed and the progress indicator becomes invisible.

However, when the exe generated by the integrated packager is run, the progress indicator just continues to run and nothing is displayed in the wv1 Webview. Incidentally if I revert to Java 8 and use Launch4j everything works as previous.

The WebView in the modal form functions correctly in both the IDE and Webview and from the exe generated by the Integrated B4JPackager11.

Any suggestions as to what I may have to change to suit Java 11 and the integrated packager?
 

bdunkleysmith

Active Member
Licensed User
Longtime User
Thanks @Erel

I don't know where I originally picked up the code I used as the basis for this app and can only assume it must have included the line : we.InitializeNewInstance("javafx.scene.web.WebEngine",Null) So as per your comment I have removed it, but probably as expected, the "problem" remains with no errors shown when launched from run_debug.bat.

I tried another URL as the start page and while the web page shows, the progress indicator still "hangs", however the following error is thrown:

"C:\Users\Public\Documents\Bryon\Java\LiveStatsAnalyser\LiveStatsV7.7\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/b4j.livestats.main Nov 15, 2020 10:37:20 PM 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(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.TransportContext.fatal(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 java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source) at javafx.web/com.sun.webkit.network.URLLoader.sendRequest(Unknown Source) at javafx.web/com.sun.webkit.network.URLLoader.doRun(Unknown Source) at javafx.web/com.sun.webkit.network.URLLoader.lambda$run$0(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at javafx.web/com.sun.webkit.network.URLLoader.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)"]

It is beyond my knowledge to decode what that points to.
 
Upvote 0
Top