Hi,
I like to send a list from vb.net using .net B4Xserialzator to B4J B4Xserialzator, vb.net can sent the array byte to mqtt server, but when
B4J receive I get a error messages.
Here is vb.net code
here id b4j code
B4J error messages
Please help me see which part i do wrong, thank you.
I like to send a list from vb.net using .net B4Xserialzator to B4J B4Xserialzator, vb.net can sent the array byte to mqtt server, but when
B4J receive I get a error messages.
Here is vb.net code
B4X:
Dim lst As New List(Of Object)
lst.Add("A")
lst.Add("B")
For i = 1 To 40
lst.Add(i)
Next
client.Publish("lacs/test", ser.ConvertObjectToBytes(lst))
here id b4j code
B4X:
If Topic="lacs/test" Then
Dim PayLoadObj() As Object = ser.ConvertBytesToObject(Payload)
Dim lst As List=PayLoadObj
for i = 0 to lst.length - 1
log(lst.get(i))
next
End If
B4X:
B4J error messages
B4X:
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [Ljava.lang.Object; (java.util.ArrayList and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')
at b4j.example.main._mqtt_messagearrived(main.java:5178)
at jdk.internal.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA$3.run(BA.java:247)
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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
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 b4j.example.main.main(main.java:29)
Please help me see which part i do wrong, thank you.