B4J Question [ABMaterial] strange error

jayel

Active Member
Licensed User
Longtime User
Hello,

I have an error that breaks the main loop :
Connected
kraan get id : 0
Parameter size : 0
ready!
ConnectPage
18/10/2016 09:33:26 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 1
Disconnected
4f3030303235410d0d
string die verzonden moet worden : O00025A
receive data from serial = 00;01;0.
lengte buffer : 9
receive in hex : 0630303B30313B302E
theme gezet
Connected
kraan get id : 0
receive data from serial = 0;0.0;0.0;0.0;0;0;0;0;0EECB
lengte buffer : 29
receive in hex : 303B302E303B302E303B302E303B303B303B303B303B3003454543420D
CRC OK
18/10/2016 09:33:26 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 4
5432463030433137450d0d
string die verzonden moet worden : T2F00C17E
receive data from serial = i grijpsucce
lengte buffer : 13
receive in hex : 0669206772696A707375636365
receive data from serial = s |%100B9F0
lengte buffer : 17
receive in hex : 73202020207C250331303003423946300D
receive grijpsuccess : i grijpsucces |%100B9F0
ISBUILD : true
main._appstart (java line: 440)
java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA$3.run(BA.java:178)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:131)
at be.robotronic.kraanserver.main._appstart(main.java:440)
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:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at be.robotronic.kraanserver.main.main(
main.java:29)
Caused by: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:120)
at anywheresoftware.b4j.object.WebSocket.access$1(WebSocket.java:110)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.RunMethodWithResult(WebSocket.java:207)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.GetVal(WebSocket.java:228)
at com.ab.abmaterial.ABMaterial.GetComponent(Unknown Source)
at com.ab.abmaterial.ABMCell.Component(Unknown Source)
at com.ab.abmaterial.ABMContainer.Component(Unknown Source)
at be.robotronic.kraanserver.main._decodeerpercent(main.java:1948)
at be.robotronic.kraanserver.main._astream_newdata(main.java:717)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 12 more
Caused by: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:299)
at anywheresoftware.b4j.object.WebSocket.sendText(WebSocket.java:107)
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:117)
... 24 more
main.main (java line: 29)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at be.robotronic.kraanserver.main.main(main.java:29)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA$3.run(BA.java:178)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:131)
at be.robotronic.kraanserver.main._appstart(main.java:440)
at sun.reflect.NativeMethodAccessorImpl.invo
ke0(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:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 2 more
Caused by: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:120)
at anywheresoftware.b4j.object.WebSocket.access$1(WebSocket.java:110)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.RunMethodWithResult(WebSocket.java:207)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.GetVal(WebSocket.java:228)
at com.ab.abmaterial.ABMaterial.GetComponent(Unknown Source)
at com.ab.abmaterial.ABMCell.Component(Unknown Source)
at com.ab.abmaterial.ABMContainer.Component(Unknown Source)
at be.robotronic.kraanserver.main._decodeerperc
ent(main.java:1948)
at be.robotronic.kraanserver.main._astream_newdata(main.java:717)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 12 more
Caused by: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:299)
at anywheresoftware.b4j.object.WebSocket.sendText(WebSocket.java:107)
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:117)
... 24 more
Parameter size : 0
ready!
ConnectPage

My webapp consists of an main loop witch timers and a serial connection on a raspberry.
Every 10 seconds there is communication with an ewternal device via serial connection.
Everything works when my weppage loads when there is no communication.
But when I press F5 the same time I communicatie with the external device via serial comm. the message loop crashes and no timer events fires anymore.

Anybody that can decypher the errormessage above?
This would be very helpfull !

Greets

John
 

alwaysbusy

Expert
Licensed User
Longtime User
When you press F5, you are disconnecting/reconnecting to the server and by doing so destroy all B4J code in the class and create a new instance of the class. You should refresh the data in the WebApp yourself when your serial communication has new data:

This is pseudo code as I do not know how your app works:

B4X:
sub serial_ReceivedNewData(data as string)
     Dim myLabel as ABMLabel = page.component("myLabel")
     myLabel.Text = data
     myLabel.Refresh  ' the new data will be shown in the webapp
end sub
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
When you press F5, you are disconnecting/reconnecting to the server and by doing so destroy all B4J code in the class and create a new instance of the class. You should refresh the data in the WebApp yourself when your serial communication has new data:

This is pseudo code as I do not know how your app works:

B4X:
sub serial_ReceivedNewData(data as string)
     Dim myLabel as ABMLabel = page.component("myLabel")
     myLabel.Text = data
     myLabel.Refresh  ' the new data will be shown in the webapp
end sub
Here's my code that decodes the string received from serial as you see at the bottom i do the refresh method :
B4X:
Sub DecodeerPercent(s_recdata As String, s_kraan As kraan)
    Dim CRCresult As Boolean = False
    Select Case s_kraan.TypeSoort.Soort
        Case TYPESOORT_SOORTCONTROLLER_INTELLILINK
            CRCresult = CheckCRC(s_recdata)
        Case TYPESOORT_SOORTCONTROLLER_INTERACTION
            CRCresult = CheckNewCRC(s_recdata)
           
    End Select
   
   
    If CRCresult = True Then
        Dim newstr() As String = Regex.Split(Chr(3),s_recdata)
        If newstr.Length > 2 Then
            Dim data As String = newstr(1)
            Dim myindex As Int = s_kraan.Index + 1
            Log("ISBUILD : " & pageopen)
            If pageopen = True Then
               
                Dim mytab As ABMTabs = selectpage.Component("tabs")
                If mytab.IsInitialized = True Then
                    Dim mytabcontainer As ABMContainer = mytab.GetTabPage("tab" & myindex)
                End If
            End If
            Select Case s_kraan.SENDCOMMAND
                Case SENDCOMMAND_SEND_GEWENST_PERCENT
                    If pageopen = True Then
                        Dim gewenstpercentinput As ABMInput = mytabcontainer.Component("txtgewenstpercent" & myindex)
                        gewenstpercentinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.GewenstPercent = data
                    Else
                        s_kraan.GewenstPercent = 100
                    End If
                Case SENDCOMMAND_SEND_GRIJPSUCCES
                    If pageopen = True Then
                        Dim grijpsuccesinput As ABMInput = mytabcontainer.Component("txtgrijpsucces" & myindex)
                        grijpsuccesinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.GrijpSuccess = data
                    Else
                        s_kraan.GrijpSuccess = 100
                    End If
                Case SENDCOMMAND_SEND_HUIDIG_PERCENT
                    If pageopen= True Then
                        Dim huidigpercentinput As ABMInput = mytabcontainer.Component("txthuidigpercent" & myindex)
                        huidigpercentinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.HuidigPercent = data
                    Else
                        s_kraan.HuidigPercent = 100
                    End If
                Case SENDCOMMAND_SEND_PAKKRACHT
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtpakkracht" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.PakKracht = data
                    Else
                        s_kraan.PakKracht = 100
                    End If
                Case SENDCOMMAND_SEND_HOUDKRACHT
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txthoudkracht" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.houdKracht = data
                    Else
                        s_kraan.houdKracht = 100
                    End If
                Case SENDCOMMAND_SEND_INDICATOR
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtindicator" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.Indicator = data
                    Else
                        s_kraan.Indicator = 100
                    End If
                Case SENDCOMMAND_SEND_PAKTIJD
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtpaktijd" & myindex)
                        myinput.Text = data
                    End If
                   
                    s_kraan.Paktijd = data
                   
                Case SENDCOMMAND_SEND_WILLEKEURIG_PAKTIJD
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtwillekeurigpaktijd" & myindex)
                        myinput.Text = data
                    End If
                   
                    s_kraan.WillekeurigPakTijd = data
                   
                Case SENDCOMMAND_SEND_TOEVALLIG_WIN
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txttoevalligwin" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.ToevalligWin = data
                    Else
                        s_kraan.ToevalligWin = 100
                    End If
                Case SENDCOMMAND_SEND_ALL
                    Select Case all_step
                        Case 1
                            If pageopen = True Then
                                Dim gewenstpercentinput As ABMInput = mytabcontainer.Component("txtgewenstpercent" & myindex)
                                gewenstpercentinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.GewenstPercent = data
                            Else
                                s_kraan.GewenstPercent = 100
                            End If
                        Case 3
                            If pageopen = True Then
                                Dim grijpsuccesinput As ABMInput = mytabcontainer.Component("txtgrijpsucces" & myindex)
                                grijpsuccesinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.GrijpSuccess = data
                            Else
                                s_kraan.GrijpSuccess = 100
                            End If
                        Case 2
                            If pageopen= True Then
                                Dim huidigpercentinput As ABMInput = mytabcontainer.Component("txthuidigpercent" & myindex)
                                huidigpercentinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.HuidigPercent = data
                            Else
                                s_kraan.HuidigPercent = 100
                            End If
                        Case 7
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtpakkracht" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.PakKracht = data
                            Else
                                s_kraan.PakKracht = 100
                            End If
                        Case 8
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txthoudkracht" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.houdKracht = data
                            Else
                                s_kraan.houdKracht = 100
                            End If
                        Case 9
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtindicator" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.Indicator = data
                            Else
                                s_kraan.Indicator = 100
                            End If
                        Case 10
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtpaktijd" & myindex)
                                myinput.Text = data
                            End If
                           
                            s_kraan.Paktijd = data
                           
                        Case 12
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtwillekeurigpaktijd" & myindex)
                                myinput.Text = data
                            End If
                           
                            s_kraan.WillekeurigPakTijd = data
                           
                        Case 11
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txttoevalligwin" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.ToevalligWin = data
                            Else
                                s_kraan.ToevalligWin = 100
                            End If
                    End Select
            End Select
            If pageopen = True Then
                mytabcontainer.Refresh
            End If
        End If
    End If

End Sub

So that can not be the solution, am I right?

Greets John
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
Yes, that is the correct way that should work. It's pressing F5 that is wrong. Doesn't the data refresh in the page when you do mytabcontainer.Refresh? Does it enter this if? (put a log in it).
B4X:
Sub DecodeerPercent(s_recdata As String, s_kraan As kraan)
    Dim CRCresult As Boolean = False
    Select Case s_kraan.TypeSoort.Soort
        Case TYPESOORT_SOORTCONTROLLER_INTELLILINK
            CRCresult = CheckCRC(s_recdata)
        Case TYPESOORT_SOORTCONTROLLER_INTERACTION
            CRCresult = CheckNewCRC(s_recdata)
           
    End Select
   
   
    If CRCresult = True Then
        Dim newstr() As String = Regex.Split(Chr(3),s_recdata)
        If newstr.Length > 2 Then
            Dim data As String = newstr(1)
            Dim myindex As Int = s_kraan.Index + 1
            Log("ISBUILD : " & pageopen)
            If pageopen = True Then
                Log("select page 1")
                Dim mytab As ABMTabs = selectpage.Component("tabs")
                If mytab.IsInitialized = True Then
                    Dim mytabcontainer As ABMContainer = mytab.GetTabPage("tab" & myindex)
                Else
                    Log("mytab is NIET geinitialiseerd")
                End If
               
            End If
            Select Case s_kraan.SENDCOMMAND
                Case SENDCOMMAND_SEND_GEWENST_PERCENT
                    If pageopen = True Then
                        Dim gewenstpercentinput As ABMInput = mytabcontainer.Component("txtgewenstpercent" & myindex)
                        gewenstpercentinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.GewenstPercent = data
                    Else
                        s_kraan.GewenstPercent = 100
                    End If
                Case SENDCOMMAND_SEND_GRIJPSUCCES
                    If pageopen = True Then
                        Log("select grijpsucces input")
                        If mytabcontainer.IsInitialized = True Then
                            Dim grijpsuccesinput As ABMInput = mytabcontainer.Component("txtgrijpsucces" & myindex)
                            Log("Grijpsucces input geslecteerd")
                            If grijpsuccesinput.IsInitialized = True Then
                                grijpsuccesinput.Text = data
                            Else
                                Log("grijpsuccesinput is NIET geinitialiseerd")
                            End If
                        Else
                            Log("tabcontainer is NIET geinitialiseerd")
                        End If
                    End If
                    If data > 0 Then
                        s_kraan.GrijpSuccess = data
                    Else
                        s_kraan.GrijpSuccess = 100
                    End If
                    Log ("hier gekomen")
                Case SENDCOMMAND_SEND_HUIDIG_PERCENT
                    If pageopen= True Then
                        Dim huidigpercentinput As ABMInput = mytabcontainer.Component("txthuidigpercent" & myindex)
                        huidigpercentinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.HuidigPercent = data
                    Else
                        s_kraan.HuidigPercent = 100
                    End If
                Case SENDCOMMAND_SEND_PAKKRACHT
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtpakkracht" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.PakKracht = data
                    Else
                        s_kraan.PakKracht = 100
                    End If
                Case SENDCOMMAND_SEND_HOUDKRACHT
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txthoudkracht" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.houdKracht = data
                    Else
                        s_kraan.houdKracht = 100
                    End If
                Case SENDCOMMAND_SEND_INDICATOR
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtindicator" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.Indicator = data
                    Else
                        s_kraan.Indicator = 100
                    End If
                Case SENDCOMMAND_SEND_PAKTIJD
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtpaktijd" & myindex)
                        myinput.Text = data
                    End If
                   
                    s_kraan.Paktijd = data
                   
                Case SENDCOMMAND_SEND_WILLEKEURIG_PAKTIJD
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txtwillekeurigpaktijd" & myindex)
                        myinput.Text = data
                    End If
                   
                    s_kraan.WillekeurigPakTijd = data
                   
                Case SENDCOMMAND_SEND_TOEVALLIG_WIN
                    If pageopen= True Then
                        Dim myinput As ABMInput = mytabcontainer.Component("txttoevalligwin" & myindex)
                        myinput.Text = data
                    End If
                    If data > 0 Then
                        s_kraan.ToevalligWin = data
                    Else
                        s_kraan.ToevalligWin = 100
                    End If
                Case SENDCOMMAND_SEND_ALL
                    Select Case all_step
                        Case 1
                            If pageopen = True Then
                                Dim gewenstpercentinput As ABMInput = mytabcontainer.Component("txtgewenstpercent" & myindex)
                                gewenstpercentinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.GewenstPercent = data
                            Else
                                s_kraan.GewenstPercent = 100
                            End If
                        Case 3
                            If pageopen = True Then
                                Dim grijpsuccesinput As ABMInput = mytabcontainer.Component("txtgrijpsucces" & myindex)
                                grijpsuccesinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.GrijpSuccess = data
                            Else
                                s_kraan.GrijpSuccess = 100
                            End If
                        Case 2
                            If pageopen= True Then
                                Dim huidigpercentinput As ABMInput = mytabcontainer.Component("txthuidigpercent" & myindex)
                                huidigpercentinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.HuidigPercent = data
                            Else
                                s_kraan.HuidigPercent = 100
                            End If
                        Case 7
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtpakkracht" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.PakKracht = data
                            Else
                                s_kraan.PakKracht = 100
                            End If
                        Case 8
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txthoudkracht" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.houdKracht = data
                            Else
                                s_kraan.houdKracht = 100
                            End If
                        Case 9
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtindicator" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.Indicator = data
                            Else
                                s_kraan.Indicator = 100
                            End If
                        Case 10
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtpaktijd" & myindex)
                                myinput.Text = data
                            End If
                           
                            s_kraan.Paktijd = data
                           
                        Case 12
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txtwillekeurigpaktijd" & myindex)
                                myinput.Text = data
                            End If
                           
                            s_kraan.WillekeurigPakTijd = data
                           
                        Case 11
                            If pageopen= True Then
                                Dim myinput As ABMInput = mytabcontainer.Component("txttoevalligwin" & myindex)
                                myinput.Text = data
                            End If
                            If data > 0 Then
                                s_kraan.ToevalligWin = data
                            Else
                                s_kraan.ToevalligWin = 100
                            End If
                    End Select
            End Select
            If pageopen = True Then
                Log("enter tabcontainer refresh")
               
                mytabcontainer.Refresh
            End If
        End If
    End If

End Sub

The pogram crashes in "Case SENDCOMMAND_SEND_GRIJPSUCCES".
Here is the log :
init mysql
okt 18, 2016 10:36:10 AM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
okt 18, 2016 10:36:11 AM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
init mysql
okt 18, 2016 10:36:11 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
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, dataSourceName -> z8kfsx9j1nmwuiqty98xe|33bd0, debugUnreturnedConnectionStackTraces -> false, description -> nu...
xStatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
theme gezet
GZipping HTML, JavaScript and CSS files...
Optimizing new and updated PNG files...
2016-10-18 10:36:16.365:INFO::main: Logging initialized @6365ms
2016-10-18 10:36:16.672:INFO:eek:ejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-10-18 10:36:16.946:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@237d2{/,file:///home/pi/tempjars/www/,AVAILABLE}
2016-10-18 10:36:16.953:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened /home/pi/tempjars/logs/b4j-2016_10_18.request.log
2016-10-18 10:36:16.987:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@8396f1{HTTP/1.1,[http/1.1]}{0.0.0.0:51050}
2016-10-18 10:36:16.989:INFO:eek:ejs.Server:main: Started @6989ms
18/10/2016 10:36:16 Connected: true
theme gezet
Connected
Disconnected
Connected
[Ljava.lang.String;@105e07d
ready!
18/10/2016 10:36:23 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 1
4f3030303235410d0d
string die verzonden moet worden : O00025A
receive data from serial = 00;01;0.0;0.0;0.0;0.0;0;0;0;0;0EECB
lengte buffer : 38
receive in hex : 0630303B30313B302E303B302E303B302E303B302E303B303B303B303B303B3003454543420D
CRC OK
18/10/2016 10:36:23 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 4
5432463030433137450d0d
string die verzonden moet worden : T2F00C17E
receive data from serial = i grijpsucces |%100B9F0
lengte buffer : 30
receive in hex : 0669206772696A70737563636573202020207C250331303003423946300D
receive grijpsuccess : i grijpsucces |%100B9F0
ISBUILD : false
hier gekomen
18/10/2016 10:36:24 Send : 130
18/10/2016 10:36:26 Kraan : EX-1/02 timed out
18/10/2016 10:36:36 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 1
4f3030303235410d0d
string die verzonden moet worden : O00025A
receive data from serial = 00;01;0.0;0.0;0.0;0.0;0;0;0;0;0EECB
lengte buffer : 38
receive in hex : 0630303B30313B302E303B302E303B302E303B302E303B303B303B303B303B3003454543420D
CRC OK
18/10/2016 10:36:37 Send : 129
okt 18, 2016 10:36:37 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
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, dataSourceName -> z8kfsx9j1nmwuiqty98xe|1363fb3, debugUnreturnedConnectionStackTraces -> false, description -> ...
tatements -> 150, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 4
Waiting for value (3 ms)
Waiting for value (1 ms)
Waiting for value (4 ms)
Waiting for value (2 ms)
Disconnected
5432463030433137450d0d
string die verzonden moet worden : T2F00C17E
receive data from serial = i grijpsucces |%100B9F0
lengte buffer : 30
receive in hex : 0669206772696A70737563636573202020207C250331303003423946300D
theme gezet
receive grijpsuccess : i grijpsucces |%100B9F0
ISBUILD : false
hier gekomen
Connected
kraan get id : 0
Lauwers John
18/10/2016 10:36:38 Send : 130
Parameter size : 0
ready!
ConnectPage
18/10/2016 10:36:40 Kraan : EX-1/02 timed out
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
18/10/2016 10:36:50 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 1
4f3030303235410d0d
string die verzonden moet worden : O00025A
receive data from serial = 00;01;0.0;0.0;0.0;0.0;0;0;0;0;0EECB
lengte buffer : 38
receive in hex : 0630303B30313B302E303B302E303B302E303B302E303B303B303B303B303B3003454543420D
CRC OK
18/10/2016 10:36:50 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 4
5432463030433137450d0d
string die verzonden moet worden : T2F00C17E
receive data from serial = i grijpsucces |%100B9F0
lengte buffer : 30
receive in hex : 0669206772696A70737563636573202020207C250331303003423946300D
receive grijpsuccess : i grijpsucces |%100B9F0
ISBUILD : true
select page 1
select grijpsucces input
Grijpsucces input geslecteerd
hier gekomen
enter tabcontainer refresh
18/10/2016 10:36:51 Send : 130
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
18/10/2016 10:36:53 Kraan : EX-1/02 timed out
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
Disconnected
theme gezet
Connected
kraan get id : 0
Lauwers John
Parameter size : 0
ready!
ConnectPage
18/10/2016 10:37:03 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 1
Disconnected
4f3030303235410d0d
string die verzonden moet worden : O00025A
receive data from serial = 00;01;0.0;0.0;0.0;0.0;0;0;0;0;0EECB
lengte buffer : 38
receive in hex : 0630303B30313B302E303B302E303B302E303B302E303B303B303B303B303B3003454543420D
CRC OK
theme gezet
Connected
kraan get id : 0
Lauwers John
18/10/2016 10:37:04 Send : 129
receive data from serial = �
lengte buffer : 2
receive in hex : 8011
sendcommand : 4
5432463030433137450d0d
string die verzonden moet worden : T2F00C17E
receive data from serial = i grijpsucces |%100B9F0
lengte buffer : 30
receive in hex : 0669206772696A70737563636573202020207C250331303003423946300D
receive grijpsuccess : i grijpsucces |%100B9F0
ISBUILD : true
select page 1
select grijpsucces input
main._appstart (java line: 440)
java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA$3.run(BA.java:178)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:131)
at be.robotronic.kraanserver.main._appstart(main.java:440)
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:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at be.robotronic.kraanserver.main.main(
main.java:29)
Caused by: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:120)
at anywheresoftware.b4j.object.WebSocket.access$1(WebSocket.java:110)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.RunMethodWithResult(WebSocket.java:207)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.GetVal(WebSocket.java:228)
at com.ab.abmaterial.ABMaterial.GetComponent(Unknown Source)
at com.ab.abmaterial.ABMCell.Component(Unknown Source)
at com.ab.abmaterial.ABMContainer.Component(Unknown Source)
at be.robotronic.kraanserver.main._decodeerpercent(main.java:1957)
at be.robotronic.kraanserver.main._astream_newdata(main.java:717)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegatin
gMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 12 more
Caused by: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:299)
at anywheresoftware.b4j.object.WebSocket.sendText(WebSocket.java:107)
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:117)
... 25 more
main.main (java line: 29)
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at be.robotronic.kraanserver.main.main(main.java:29)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.BA$3.run(BA.java:178)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:131)
at be.robotronic.kraanserver.main._appstart(main.java:440)
at sun.reflect.NativeMethodAccessorImpl.invo
ke0(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:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 2 more
Caused by: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:120)
at anywheresoftware.b4j.object.WebSocket.access$1(WebSocket.java:110)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.RunMethodWithResult(WebSocket.java:207)
at anywheresoftware.b4j.object.WebSocket$JQueryElement.GetVal(WebSocket.java:228)
at com.ab.abmaterial.ABMaterial.GetComponent(Unknown Source)
at com.ab.abmaterial.ABMCell.Component(Unknown Source)
at com.ab.abmaterial.ABMContainer.Component(Unknown Source)
at be.robotronic.kraanserver.main._decodeerperc
ent(main.java:1957)
at be.robotronic.kraanserver.main._astream_newdata(main.java:717)
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:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 12 more
Caused by: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]
at org.eclipse.jetty.websocket.common.WebSocketSession.getRemote(WebSocketSession.java:299)
at anywheresoftware.b4j.object.WebSocket.sendText(WebSocket.java:107)
at anywheresoftware.b4j.object.WebSocket.get(WebSocket.java:117)
... 25 more
Parameter size : 0
ready!
ConnectPage
 
Upvote 0

jayel

Active Member
Licensed User
Longtime User
I solved the problem.
The variable thats checks in my main thread if the page is open (pageopen).
I set it to true when the ws_connected event fired of my page, but this is wrong, I have to set it when ConnectPage event fires (at the end) so every component in my DOM is loaded.

Thanks to Alwaysbusy for pointing me to the right direction. (we got to meet up for a good belgian beer in Ypres ;))
 
Upvote 0
Top