vfafou Well-Known Member Licensed User Longtime User Jun 21, 2020 #1 Hello! Trying to send a specific serialised map type from B4J to mobile client (B4A) via web socket connection, an error is occurring at the server side. The code executing is: B4X: Copy Public Sub SendMessages(Messages As List) ws.RunFunction("NewMessage", Messages) ws.Flush End Sub where Messages List is not empty! It has the item: B4X: Copy (ArrayList) [360, eJwT4WBgYGBkARIhlQWpjMxARpB7ECNItCg/McUvMTeVkQ/IOdd2bvO5vec7zzefbzm3nZELJl+am5RaxMgAMkQAKuZbmpeZnFmQmJNZUskoBNI75dzOc1vP957bcb4VaEYzUD8TUDg5ghGk0QDCiYRyWKGmRKDxofIAxh8uAw==] with the following structure: B4X: Copy Private peMap As Map peMap.Initialize peMap.Put("Type","POK") peMap.Put("cid" ,cid) 'where cid = "1007898" then I call: B4X: Copy Private peMapS As String = Utils.ConvertObjectToString(peMap) CallSubDelayed3(PushWebShared,"SendClientMessage",peMapS,id) and the error is: B4X: Copy Error occurred on line: 863 java.lang.RuntimeException: java.lang.NullPointerException at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:142) at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:132) at anywheresoftware.b4j.object.WebSocket.RunFunction(WebSocket.java:298) 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:498) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:676) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98) at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487) at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467) at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541) at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30) at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26) at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119) at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:153) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) 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:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98) at anywheresoftware.b4a.BA.raiseEvent(BA.java:78) at rm.rmtunnel.main.main(main.java:29) Caused by: java.lang.NullPointerException at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:139) ... 31 more Note that other serialised maps are transferred without problems! Any idea what could cause this? Thank you in advance! Last edited: Jun 21, 2020
Hello! Trying to send a specific serialised map type from B4J to mobile client (B4A) via web socket connection, an error is occurring at the server side. The code executing is: B4X: Copy Public Sub SendMessages(Messages As List) ws.RunFunction("NewMessage", Messages) ws.Flush End Sub where Messages List is not empty! It has the item: B4X: Copy (ArrayList) [360, eJwT4WBgYGBkARIhlQWpjMxARpB7ECNItCg/McUvMTeVkQ/IOdd2bvO5vec7zzefbzm3nZELJl+am5RaxMgAMkQAKuZbmpeZnFmQmJNZUskoBNI75dzOc1vP957bcb4VaEYzUD8TUDg5ghGk0QDCiYRyWKGmRKDxofIAxh8uAw==] with the following structure: B4X: Copy Private peMap As Map peMap.Initialize peMap.Put("Type","POK") peMap.Put("cid" ,cid) 'where cid = "1007898" then I call: B4X: Copy Private peMapS As String = Utils.ConvertObjectToString(peMap) CallSubDelayed3(PushWebShared,"SendClientMessage",peMapS,id) and the error is: B4X: Copy Error occurred on line: 863 java.lang.RuntimeException: java.lang.NullPointerException at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:142) at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:132) at anywheresoftware.b4j.object.WebSocket.RunFunction(WebSocket.java:298) 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:498) at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:676) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98) at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:487) at anywheresoftware.b4a.keywords.Common.access$0(Common.java:467) at anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Common.java:541) at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:30) at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:26) at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119) at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:153) at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309) at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167) 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:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98) at anywheresoftware.b4a.BA.raiseEvent(BA.java:78) at rm.rmtunnel.main.main(main.java:29) Caused by: java.lang.NullPointerException at anywheresoftware.b4j.object.WebSocket.set(WebSocket.java:139) ... 31 more Note that other serialised maps are transferred without problems! Any idea what could cause this? Thank you in advance!
Erel B4X founder Staff member Licensed User Longtime User Jun 22, 2020 #2 Are you using the latest version of B4J? The line number don't match. Upvote 0
vfafou Well-Known Member Licensed User Longtime User Jun 22, 2020 #3 Erel said: Are you using the latest version of B4J? The line number don't match. Click to expand... Hello Erel! Thank you for your response! I'm using B4J 8.31. Upvote 0
Erel said: Are you using the latest version of B4J? The line number don't match. Click to expand... Hello Erel! Thank you for your response! I'm using B4J 8.31.
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2020 #4 Put a breakpoint in PushWebShared SendClientMessage and see what exactly happens there. Upvote 0
vfafou Well-Known Member Licensed User Longtime User Jun 23, 2020 #5 Erel said: Put a breakpoint in PushWebShared SendClientMessage and see what exactly happens there. Click to expand... Good morning Erel! I have already done this and the line causing the error is: B4X: Copy ws.RunFunction("NewMessage", Messages) but Messages List is not empty! Upvote 0
Erel said: Put a breakpoint in PushWebShared SendClientMessage and see what exactly happens there. Click to expand... Good morning Erel! I have already done this and the line causing the error is: B4X: Copy ws.RunFunction("NewMessage", Messages) but Messages List is not empty!
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2020 #6 My guess is that you are trying to send it to an invalid WebSocket (ws). Upvote 0