0

I am trying to run JDA Discord Bot, but getting this error:

[JDA MainWS-ReadThread] INFO net.dv8tion.jda.core.requests.WebSocketClient - Connected to WebSocket
[JDA MainWS-ReadThread] ERROR net.dv8tion.jda.core.requests.WebSocketClient - There was an error in the WebSocket connection
java.lang.NoSuchMethodError: org.json.JSONArray.iterator()Ljava/util/Iterator;
    at net.dv8tion.jda.core.requests.WebSocketClient.updateTraces(WebSocketClient.java:165)
    at net.dv8tion.jda.core.requests.WebSocketClient.onEvent(WebSocketClient.java:797)
    at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:745)
    at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:903)
    at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
    at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
    at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
    at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

I can't find what's wrong,

I have asked at the JDA GitHub but they say I have to get the latest org.json which I already have. So I am confused.

Hope someone can help me there.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Your `pom.xml` looks good, but in _Referenced Libraries_ there is `json-simple-1.1.1.jar` instead of [`json-20180813.jar`](https://bintray.com/version/files/bintray/jcenter/org.json%3Ajson/20180813?order=asc&sort=name&basePath=org%2Fjson%2Fjson%2F20180813&tab=files) (see also [here](https://github.com/stleary/JSON-java/commit/d2cd1a8df5cd6392650f455a5df844ec55c3e1dc)). Does right-click the project and choose _Maven > Update Project..._ fix your issue? – howlger Apr 22 '19 at 18:05
  • Right clicking the project and choosing Maven > Update Project fixed my issue, Thanks. – Mohammed Khmaisy Apr 22 '19 at 18:11

1 Answers1

0

Indeed, the org.json.JSONArray.iterator() did not exist from the beginning, but was added later.

Your pom.xml looks good, but in Referenced Libraries there is json-simple-1.1.1.jar instead of json-20180813.jar.

Right-click the project and choose Maven > Update Project...

howlger
  • 31,050
  • 11
  • 59
  • 99