如何修复 java 中的 NoSuchMethodError
How to fix NoSuchMethodError in java
我正在尝试 运行 JDA Discord Bot,但出现此错误:
[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)
我找不到问题所在,
- 这是我的
pom.xml
:https://hasteb.in/agaseniz.xml
- 我的参考库中也有这些库:http://prntscr.com/nfdquv
我已经在 JDA GitHub 询问过,但他们说我必须得到最新的 org.json,我已经有了。所以我很困惑。
希望有人能帮助我。
的确,org.json.JSONArray.iterator()
从一开始就不存在,但是was added later。
您的 pom.xml
看起来不错,但是 在 参考库 中有 json-simple-1.1.1.jar
而不是 json-20180813.jar
.
右键单击项目并选择 Maven > 更新项目...
我正在尝试 运行 JDA Discord Bot,但出现此错误:
[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)
我找不到问题所在,
- 这是我的
pom.xml
:https://hasteb.in/agaseniz.xml - 我的参考库中也有这些库:http://prntscr.com/nfdquv
我已经在 JDA GitHub 询问过,但他们说我必须得到最新的 org.json,我已经有了。所以我很困惑。
希望有人能帮助我。
的确,org.json.JSONArray.iterator()
从一开始就不存在,但是was added later。
您的 pom.xml
看起来不错,但是 在 参考库 中有 json-simple-1.1.1.jar
而不是 json-20180813.jar
.
右键单击项目并选择 Maven > 更新项目...