WalshyDev/AutoCleanBot

Bot not joining my Server

Closed this issue · 5 comments

When starting the bot it does not join the server. The bot is setup within the Discord developer page, the bot is connected to my Discord server over OAuth and the database is setup within VestaCP. It runs completely fine when started:

C:\Users\Administrator\Desktop\AutoCleanBot>java -jar C:\Users\Administrator\Desktop\AutoCleanBot\AutoCleanBot-1.0.jar
19:40:33.802 [JDA RateLimit-Queue Pool - Thread 1] DEBUG net.dv8tion.jda.core.requests.Requester - Received response with following cf-rays: [3fea4ed30d5c3eaa-ZRH]
19:40:33.974 [JDA RateLimit-Queue Pool - Thread 1] DEBUG net.dv8tion.jda.core.requests.Requester - Received response with following cf-rays: [3fea4ed37db73eaa-ZRH]
19:40:33.976 [main] INFO net.dv8tion.jda.core.JDA - Login Successful!
19:40:34.413 [JDA MainWS-ReadThread] INFO net.dv8tion.jda.core.requests.WebSocketClient - Connected to WebSocket
19:40:34.413 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Received new CF-RAY: 3fea4ed59f553e80-ZRH
19:40:34.414 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Sending Identify-packet...
19:40:34.418 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Got HELLO packet (OP 10). Initializing keep-alive.
19:40:34.424 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Received a _trace for HELLO (OP: 10) with ["gateway-prd-main-87qx"]
19:40:34.590 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Received a _trace for READY (OP: 0) with ["gateway-prd-main-87qx","discord-sessions-prd-1-6"]
19:40:34.867 [JDA MainWS-ReadThread] INFO net.dv8tion.jda.core.JDA - Finished Loading!

After that I am getting this:
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:550)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:537)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:527)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:512)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:480)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:498)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:494)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:1705)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1629)
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:637)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:351)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:224)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:418)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:138)
at com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:109)
at com.walshydev.jba.SQLController.getConnection(SQLController.java:20)
at com.walshydev.jba.SQLController.runSqlTask(SQLController.java:24)
at com.walshydev.autocleanbot.AutoCleanBot.scheduleCleans(AutoCleanBot.java:48)
at com.walshydev.autocleanbot.AutoCleanBot.run(AutoCleanBot.java:43)
at com.walshydev.jba.JBAListener.onReady(JBAListener.java:27)
at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:356)
at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
at net.dv8tion.jda.core.requests.WebSocketClient.ready(WebSocketClient.java:202)
at net.dv8tion.jda.core.handle.ReadyHandler.guildLoadComplete(ReadyHandler.java:166)
at net.dv8tion.jda.core.handle.ReadyHandler.guildSetupComplete(ReadyHandler.java:193)
at net.dv8tion.jda.core.handle.GuildCreateHandler.lambda$handleInternally$0(GuildCreateHandler.java:45)
at net.dv8tion.jda.core.entities.EntityBuilder.createGuildFirstPass(EntityBuilder.java:336)
at net.dv8tion.jda.core.handle.GuildCreateHandler.handleInternally(GuildCreateHandler.java:39)
at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:1051)
at net.dv8tion.jda.core.requests.WebSocketClient.onTextMessage(WebSocketClient.java:691)
at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1099)
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)
Caused by: com.mysql.cj.core.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:54)
at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:93)
at com.mysql.cj.core.exceptions.ExceptionFactory.createException(ExceptionFactory.java:133)
at com.mysql.cj.core.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:149)
at com.mysql.cj.mysqla.io.MysqlaSocketConnection.connect(MysqlaSocketConnection.java:83)
at com.mysql.cj.mysqla.MysqlaSession.connect(MysqlaSession.java:122)
at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:1647)
... 31 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.mysql.cj.core.io.StandardSocketFactory.connect(StandardSocketFactory.java:202)
at com.mysql.cj.mysqla.io.MysqlaSocketConnection.connect(MysqlaSocketConnection.java:57)
... 33 more
19:41:42.015 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Resending 0 cached events...
19:41:42.017 [JDA MainWS-ReadThread] DEBUG net.dv8tion.jda.core.requests.WebSocketClient - Sending of cached events finished.

Looks like an sql issue

Looks like it can't connect to your MySQL database, make sure the details are right and VestaCP is allowing connections

Okay fixed, used my local database IP instead and now it works. It was the ports not being opened on my router.

Good to hear it's solved!