B4J Question [Solved] B4J - Error in Build StandAlone Package, but not in Debug and Release Mode

Sabotto

Active Member
Licensed User
This simple code, in B4J works in both Debug and Release. But when I run Project - Build Standalone Package - the generated exe doesn't work and gives error! By executing the file "run_debug.bat", I get the Log that I attach, but I could not understand what the error is. Can anyone tell me why?
(if you want, i can attach the test project)

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private DirDestination As String ' Folder where i save the download file
            
End Sub

Public Sub Initialize
    
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    
    Root = Root1
    Root.LoadLayout("MainPage")
        
    DirDestination = File.DirApp
    
    Wait for (GetFileFromSite ) complete (Result As Boolean)
    
    If Result=False Then
        xui.MsgboxAsync("Impossibile scaricare i files dal sito!","Error")
    Else
        xui.MsgboxAsync("Ok download Riuscito","OK")
    End If
        
End Sub

Sub GetFileFromSite As ResumableSub

    Wait For (DownloadFile) Complete (Result As Boolean)
    If Result=False Then
        xui.MsgboxAsync("Il download del file non è riuscito. ","Download non riuscito")
    End If
    Return Result
    
End Sub


Sub DownloadFile As ResumableSub
    
    Dim result As Boolean = False
    Dim NomeFileCompleto As String =  File.Combine("https://www.portale.it", "image1.jpg")

    Try
        Dim j As HttpJob
        j.Initialize("", Me)
        j.Download(NomeFileCompleto)
        
        Wait For (j) JobDone(j As HttpJob)
        If j.Success Then
            Dim out As OutputStream = File.OpenOutput(DirDestination, "image1.jpg", False)
        
            'copia il file appena scaricato (j.getInputStream) nel file appena creato (out)
            File.Copy2(j.GetInputStream, out)
            out.Close '<------ very important
            result=True
        End If
        j.Release
    Catch
        xui.MsgBoxAsync ("Errore nello scaricare il file dal sito!" ,"Errore")
    End Try
    Return result

End Sub

Private Sub B4XMainPage_CloseRequest(EventData As Event)
    EventData.Consume
    B4XPages.ClosePage(Me)
    ExitApplication
End Sub


Log File when run "run_debug.bat" in Build Folder created by Menu Build Standalone Package

B4X:
C:\Users\Antonio\Desktop\Test Package Exe B4J\B4J\Objects\temp\build\bin>java.exe @release_java_modules.txt  -m b4j/b4j.example.main
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
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.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)
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure, Response:

C:\Users\Antonio\Desktop\Test Package Exe B4J\B4J\Objects\temp\build\bin>pause
Premere un tasto per continuare . . .
 

bdunkleysmith

Active Member
Licensed User
Longtime User
Upvote 0
Top