something went wrong with json

82 Views Asked by At

my codes on B4J ran well on my local laptop, but went error when i up and tried to run it on a server. here's the ss.[error says, java.lang.RuntimeException: java.lang.RuntimeException: JSON Object expected]

enter image description here

What i don't get is that run in local i don't face such a problem, here's the ss. [it runs perfectly, the json file can be executed and processed].

enter image description here

now here's my code to retrieve and process the json on B4j:

Sub tickInterval_tick
    time.Enabled = False
    Dim endpointList As List
    Dim endpointMap As Map
    endpointList = File.ReadList(File.DirApp, "endpoints.json")
    Dim filePath As String = File.Combine(File.DirApp, "endpoints.json")
    Log("File path: " & filePath)
    Dim parser As JSONParser
    endpointMap.Initialize
    parser.Initialize(endpointList.Get(0))
    Dim endpointArray As List = parser.NextArray
    For t = 0 To endpointArray.Size - 1
        endpointMap = endpointArray.Get(t)
        ContainerReady(endpointMap.Get("name"), endpointMap.Get("host"), endpointMap.Get("token"))
    Next
    time.Enabled= True
End Sub

and this is the inside of my endpoints.json:

[{"host":"https://xxxx:xxxx:xxxx","name":"OKD 1","token":"Bearer xxxxxxxxxx"}]

went error when i up and tried to run it on a server

error message: java.lang.RuntimeException: java.lang.RuntimeException: JSON Object expected.

        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
        at anywheresoftware.b4a.BA$3.run(BA.java:267)
        at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
        at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
        at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:180)
        at b4j.example.main._appstart(main.java:85)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:577)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
        at b4j.example.main.main(main.java:28)
Caused by: java.lang.RuntimeException: JSON Object expected.
        at anywheresoftware.b4j.objects.collections.JSONParser.NextObject(JSONParser.java:67)
        at b4j.example.main._shcurl_processcompleted(main.java:424)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:577)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
0

There are 0 best solutions below