B4J Question [ABMaterial] java.lang.RuntimeException: JSON Object expected

prajinpraveen

Active Member
Licensed User
Longtime User
Good Day,

I get this error very often. is there a way to fix this error?
B4X:
java.lang.RuntimeException: JSON Object expected.
    at anywheresoftware.b4j.objects.collections.JSONParser.NextObject(JSONParser.java:50)
    at anywheresoftware.b4j.object.WebSocketModule$Adapter.onWebSocketText(WebSocketModule.java:110)
    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextMessage(JettyListenerEventDriver.java:189)
    at org.eclipse.jetty.websocket.common.message.SimpleTextMessage.messageComplete(SimpleTextMessage.java:69)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:66)
    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextFrame(JettyListenerEventDriver.java:158)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:162)
    at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:476)
    at org.eclipse.jetty.websocket.common.extensions.AbstractExtension.nextIncomingFrame(AbstractExtension.java:183)
    at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.nextIncomingFrame(PerMessageDeflateExtension.java:105)
    at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.forwardIncoming(CompressExtension.java:143)
    at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.incomingFrame(PerMessageDeflateExtension.java:85)
    at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:220)
    at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:220)
    at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:245)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:560)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:391)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
    at java.base/java.lang.Thread.run(Unknown Source)
 

derez

Expert
Licensed User
Longtime User
Try to correct the code that created it...
If you don't know how - show the code here and maybe someone will help.
 
Upvote 0

prajinpraveen

Active Member
Licensed User
Longtime User
Thank you for the response. I am not sure which code is affecting this.
When a form (AMB) is opened, it takes a few seconds more than normally it takes. Any click on the buttons on the modal container causes this error on the server.

This doesnot happen all the time. Is there a way to trap more information about the error. I can post a video if need be. many thanks
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Add:

ABMShared.RedirectOutput(File.DirApp,"mylogfile.txt")

to the appstart in Main - just before StartMessageLoop.


B4X:
Sub RedirectOutput (Dir As String, FileName As String) 'ignore
   #if RELEASE
   Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) 'Set to True to append the logs
   Dim ps As JavaObject
   ps.InitializeNewInstance("java.io.PrintStream", Array(out, True, "utf8"))
   Dim jo As JavaObject
   jo.InitializeStatic("java.lang.System")
   jo.RunMethod("setOut", Array(ps))
   jo.RunMethod("setErr", Array(ps))
   #end if
End Sub

Add Log("Last Error: "&LastException.message) - or other logs to see what might be happening....
 
Upvote 0

prajinpraveen

Active Member
Licensed User
Longtime User
Thank you. The error logging is enabled.
I have uploaded the errorlog. The same error appeared when any of the buttons on the modal(page) was clicked. To resolve this, F5 was pressed a few times to refresh the page
 

Attachments

  • logs.txt
    427.8 KB · Views: 304
Upvote 0

prajinpraveen

Active Member
Licensed User
Longtime User
upon further investigation, have picked up that the error occurs when i navigate from one page to another.
When i navigate from one page to another page, on Chrome console i get this error(attached) and the page stops to respond.



upload_2018-8-18_20-19-24.png


Any further actions/clicks on the page results in the error message on the server in the first post

Thank you
 
Upvote 0
Top