MySQL Connection problem

Discussion in 'Plugin Development' started by Goblom, Oct 31, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Goblom

    (No code will be posted but you will be linked with the MySQL Connector class we are using)

    Hitman has been running smoothly using a localhost database but we are migrating all the servers over to a dedi and keeping our database on a separate machine.

    Once we moved all the servers to the new host we noticed that the plugin was now unable to connect to the mysql database. Our Database server has IP Tables turned off (due to testing) and after a little investigating we believe that --skip-networking is not used in our mysql startup script.
    The MySQL Connector Class
    Error:
    Code:
    2013-10-31 11:53:35 | [???] 11:53:35 [INFO] [Hitman] Enabling Hitman v0.0.1-SNAPSHOT
    2013-10-31 11:53:35 | [???] 11:53:35 [INFO] [Hitman] [Warning] Hitman is in Debug Mode!
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    2013-10-31 11:53:35 | [???]
    2013-10-31 11:53:35 | [???] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2334)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2371)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.sql.DriverManager.getConnection(DriverManager.java:215)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.fallen.hitman.databases.MySQL.connect(MySQL.java:24)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.fallen.hitman.Database.init(Database.java:60)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.fallen.hitman.Hitman.onEnable(Hitman.java:58)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:284)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:266)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:315)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:292)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:252)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:152)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE] Caused by: java.net.ConnectException: Connection refused
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.PlainSocketImpl.socketConnect(Native Method)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.Socket.connect(Socket.java:579)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.Socket.connect(Socket.java:528)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.Socket.<init>(Socket.java:425)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at java.net.Socket.<init>(Socket.java:241)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:254)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292)
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE]    ... 28 more
    2013-10-31 11:53:35 | [???] 11:53:35 [SEVERE] Error occurred while enabling Hitman v0.0.1-SNAPSHOT (Is it up to date?)
    2013-10-31 11:53:35 | [???] java.lang.NullPointerException
    2013-10-31 11:53:35 | [???] at net.fallen.hitman.Database.query(Database.java:94)
    2013-10-31 11:53:35 | [???] at net.fallen.hitman.Permissions.<init>(Permissions.java:22)
    2013-10-31 11:53:35 | [???] at net.fallen.hitman.Hitman.onEnable(Hitman.java:69)
    2013-10-31 11:53:35 | [???] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
    2013-10-31 11:53:35 | [???] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
    2013-10-31 11:53:35 | [???] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
    2013-10-31 11:53:35 | [???] at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:284)
    2013-10-31 11:53:35 | [???] at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:266)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:315)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:292)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:252)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:152)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
    2013-10-31 11:53:35 | [???] at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    2013-10-31 11:53:35 | [???] 11:53:35 [INFO] Server permissions file permissions.yml is empty, ignoring it
    2013-10-31 11:53:35 | [???] 11:53:35 [INFO] Done (0.663s)! For help, type "help" or "?"
    2013-10-31 11:54:01 > (@external) ~stop
    2013-10-31 11:54:01 # stopping minecraft server
    2013-10-31 11:54:01 | [???] 11:54:01 [INFO] CONSOLE: Forcing save..
    2013-10-31 11:54:01 | [???] 11:54:01 [INFO] CONSOLE: Save complete.
    2013-10-31 11:54:01 | [???] 11:54:01 [INFO] CONSOLE: Stopping the server..
    2013-10-31 11:54:01 | [???] 11:54:01 [INFO] Stopping server
    2013-10-31 11:54:01 | [???] 11:54:01 [INFO] [Hitman] Disabling Hitman v0.0.1-SNAPSHOT
    2013-10-31 11:54:01 | [???] 11:54:01 [SEVERE] Error occurred while disabling Hitman v0.0.1-SNAPSHOT (Is it up to date?)
    2013-10-31 11:54:01 | [???] java.lang.NullPointerException
    2013-10-31 11:54:01 | [???] at net.fallen.hitman.Database.shutdown(Database.java:73)
    2013-10-31 11:54:01 | [???] at net.fallen.hitman.Hitman.onDisable(Hitman.java:118)
    2013-10-31 11:54:01 | [???] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:219)
    2013-10-31 11:54:01 | [???] at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:481)
    2013-10-31 11:54:01 | [???] at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:400)
    2013-10-31 11:54:01 | [???] at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:393)
    2013-10-31 11:54:01 | [???] at org.bukkit.craftbukkit.v1_6_R3.CraftServer.disablePlugins(CraftServer.java:279)
    2013-10-31 11:54:01 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.stop(MinecraftServer.java:345)
    2013-10-31 11:54:01 | [???] at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:452)
    2013-10-31 11:54:01 | [???] at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    Edit: On a side note. This is not a problem with the code itself but with the mysql servers. If the problem is withe the code then we made a mistake (but i doubt it).

    If anyone knows how to fix this problem I will be in your debt
     
  2. Goblom its kinda hard to help you if you don't give your code
     
  3. Offline

    Goblom

    Unknown_Stalker_ I know this will be tough to hear but Hitman is a private plugin. No code will be released. If you read the post (Specifically the blue words) you will see our EXACT MySQL Connector Class. Here Let me show you gain.
     
  4. Offline

    1Rogue

    Don't use a persistant connection, open/close connections as necessary.
     
  5. Offline

    Goblom

    1Rogue Do you know how to fix this ?
    Code:
    11:53:35 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
     
  6. Offline

    1Rogue

     
  7. Offline

    e-freak1996

    1Rogue
    It requires the connection on server start, but I think it doesn't even connect to the MySQL server. I think the MySQL server has somehow external connections disabled but I don't know how to solve this issue...
     
  8. Offline

    RealDope

    If the server has external connections disabled why are you talking to us here? It's not a Bukkit problem.

    Many SQL servers require that you list all external IPs which are allowed to access the database. Check with your provider (or check for yourself if you have access / host it) to see if the minecraft server's IP is on that list.
     
  9. Offline

    frostalf

    if --skip-networking or the server is set to listen on 127.0.0.1 or if remote connections are disabled, you will not be able to connect to the mysql server unless your server is on the same host. So, to allow remote connections, make sure the server is set to listen on an ip other than 127.0.0.1, does not have --skip-networking (those two things are in in the my.cnf file or my.ini for windows) the allowing of remote connections is done via logging into the mysql server and setting a user that is permitted to log in other than from 127.0.0.1 or localhost.
     
Thread Status:
Not open for further replies.

Share This Page