B4J Question "JSON Array expected" Error when Load layout

Discussion in 'B4J Questions' started by universengo, Jul 31, 2019.

  1. universengo

    universengo Member

    Hello experts!
    Today I continue to have errors about JSON but I don't know how to fix it. May the experts help me.
    The error occurred when I loaded the layout.
    Code:
    Main.MainForm.RootPane.LoadLayout("frmDangNhap")
    See log below:
    Code:
    java.lang.RuntimeException: JSON Array expected.
        at anywheresoftware.b4j.objects.collections.JSONParser.NextArray(
    JSONParser.java:62)
        at anywheresoftware.b4j.objects.MenuItemWrapper$MenuBarWrapper.parseMenusJson(MenuItemWrapper.java:
    259)
        at anywheresoftware.b4j.objects.NodeWrapper$ControlWrapper.build(NodeWrapper.java:
    1020)
        at anywheresoftware.b4j.objects.ComboBoxWrapper.build(ComboBoxWrapper.java:
    109)
        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.DynamicBuilder.build(DynamicBuilder.java:
    16)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    125)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:
    84)
        at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:
    84)
        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.runMethod(
    Shell.java:632)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:237)
        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.BA.raiseEvent(BA.java:
    78)
        at b4j.example.main.start(main.java:
    42)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$
    161(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$
    174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$
    null$147(WinApplication.java:177)
        at java.lang.Thread.run(
    Thread.java:748)
    java.lang.RuntimeException: JSON 
    Array expected.
        at anywheresoftware.b4j.objects.collections.JSONParser.NextArray(
    JSONParser.java:62)
        at anywheresoftware.b4j.objects.MenuItemWrapper$MenuBarWrapper.parseMenusJson(MenuItemWrapper.java:
    259)
        at anywheresoftware.b4j.objects.NodeWrapper$ControlWrapper.build(NodeWrapper.java:
    1020)
        at anywheresoftware.b4j.objects.ComboBoxWrapper.build(ComboBoxWrapper.java:
    109)
        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.DynamicBuilder.build(DynamicBuilder.java:
    16)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    125)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:
    84)
        at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:
    84)
        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.runMethod(
    Shell.java:632)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:237)
        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.BA.raiseEvent(BA.java:
    78)
        at b4j.example.main.start(main.java:
    42)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$
    161(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$
    174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$
    null$147(WinApplication.java:177)
        at java.lang.Thread.run(
    Thread.java:748)
    java.lang.RuntimeException: JSON 
    Array expected.
        at anywheresoftware.b4j.objects.collections.JSONParser.NextArray(
    JSONParser.java:62)
        at anywheresoftware.b4j.objects.MenuItemWrapper$MenuBarWrapper.parseMenusJson(MenuItemWrapper.java:
    259)
        at anywheresoftware.b4j.objects.NodeWrapper$ControlWrapper.build(NodeWrapper.java:
    1020)
        at anywheresoftware.b4j.objects.ComboBoxWrapper.build(ComboBoxWrapper.java:
    109)
        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.DynamicBuilder.build(DynamicBuilder.java:
    16)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    125)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:
    204)
        at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:
    84)
        at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:
    84)
        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.runMethod(
    Shell.java:632)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:237)
        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.BA.raiseEvent(BA.java:
    78)
        at b4j.example.main.start(main.java:
    42)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$
    161(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$
    174(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$
    null$172(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$
    173(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$
    Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$
    null$147(WinApplication.java:177)
        at java.lang.Thread.run(
    Thread.java:748)
    Thanks so much!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The menu json string is invalid.
     
    universengo and BillMeyer like this.
  3. universengo

    universengo Member

    Thanks Erel,
    My menu is still working. Can you show me how to find this error according log?

    I have just tried clear all my menu bar (menu items code) and still error.
     
    Last edited: Jul 31, 2019
  4. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload the layout file?
     
    universengo likes this.
  5. universengo

    universengo Member

  6. Erel

    Erel Administrator Staff Member Licensed User

    My mistake. The invalid json string is in one of the comboboxes context menu strings.
     
    universengo likes this.
  7. universengo

    universengo Member

    Wow, As your help. I have just found some numbers in my comboboxes context menu strings (I don't know how it was entered here).
    Thanks Erel very very much!!!

    Now I think, This error is Sovled !
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice