B4J Question Java exception:JSON Array Expected

LenS

Member
Good Morning.
I am new to B4J and have no experience with Java at all. I am working on my first B4J program and I am getting the error message below. It seems to have no apparent effect on the running of the program... it runs perfectly well but throws an error at this point in AppStart:

MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show

Thanks in advance for your help.
Len

The error appearing is:

java.lang.RuntimeException: JSON Array expected.
at anywheresoftware.b4j.objects.collections.JSONParser.NextArray(JSONParser.java:79)
at anywheresoftware.b4j.objects.MenuItemWrapper$MenuBarWrapper.parseMenusJson(MenuItemWrapper.java:276)
at anywheresoftware.b4j.objects.NodeWrapper$ControlWrapper.build(NodeWrapper.java:1049)
at anywheresoftware.b4j.objects.ComboBoxWrapper.build(ComboBoxWrapper.java:126)
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.DynamicBuilder.build(DynamicBuilder.java:33)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:142)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:228)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:228)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:101)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
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.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
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:109)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:96)
at b4j.example.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)








Can someone explain it's meaning and how to correct it? Thanks in advance.
Len
 

aeric

Expert
Licensed User
Longtime User
Without code, noone can help you.
The error means your app expect a JSON array format but the returned string does not meet the format.
A JSON format looks something like this:
JSON:
{
    "id": 1,
    "desc": "Some description",
    "data": ["alice", "bob"]
}
 
Upvote 0

LenS

Member
Without code, noone can help you.
The error means your app expect a JSON array format but the returned string does not meet the format.
A JSON format looks something like this:
JSON:
{
    "id": 1,
    "desc": "Some description",
    "data": ["alice", "bob"]
}
Thank you. As it turns out, after some digging, I discovered that it was an error in a context menu setting. Nevertheless, thanks for your reply. Issue solved and I learned something new.
Len
 
Upvote 0
Top