Establishing a connection

Discussion in 'Plugin Development' started by coobro123, Oct 12, 2013.

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

    coobro123

    Hi guys, So basically what I want is too connect to a database and thats it lol,
    Nothing else just that. I am not sure what is quite wrong but here is the code and the error.
    Error:
    Code:
    09:24:49 [INFO] coobro123[/10.0.0.6:50489] logged in with entity id 1142 at ([world] 46.55720228787096, 81.0, 261.4188440790724)
    09:24:49 [INFO] Loaded player file for coobro123
    09:24:50 [SEVERE] java.net.ConnectException: Connection refused
    09:24:50 [SEVERE]    at java.net.PlainSocketImpl.socketConnect(Native Method)
    09:24:50 [SEVERE]    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
    09:24:50 [SEVERE]    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
    09:24:50 [SEVERE]    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
    09:24:50 [SEVERE]    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
    09:24:50 [SEVERE]    at java.net.Socket.connect(Socket.java:527)
    09:24:50 [SEVERE]    at java.net.Socket.connect(Socket.java:476)
    09:24:50 [SEVERE]    at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
    09:24:50 [SEVERE]    at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
    09:24:50 [SEVERE]    at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
    09:24:50 [SEVERE]    at sun.net.www.http.HttpClient.<init>(HttpClient.java:227)
    09:24:50 [SEVERE]    at sun.net.www.http.HttpClient.New(HttpClient.java:300)
    09:24:50 [SEVERE]    at sun.net.www.http.HttpClient.New(HttpClient.java:317)
    09:24:50 [SEVERE]    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
    09:24:50 [SEVERE]    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
    09:24:50 [SEVERE]    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
    09:24:50 [SEVERE]    at com.gmail.cooperclark132.plugin.MFix.Main.onPLayerJoin(Main.java:44)
    09:24:50 [SEVERE]    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    09:24:50 [SEVERE]    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    09:24:50 [SEVERE]    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    09:24:50 [SEVERE]    at java.lang.reflect.Method.invoke(Method.java:597)
    09:24:50 [SEVERE]    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
    09:24:50 [SEVERE]    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    09:24:50 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
    09:24:50 [SEVERE]    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.PlayerList.c(PlayerList.java:206)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.PlayerList.a(PlayerList.java:102)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.PendingConnection.e(PendingConnection.java:130)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.PendingConnection.d(PendingConnection.java:43)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.DedicatedServerConnectionThread.a(DedicatedServerConnectionThread.java:41)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:29)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
    09:24:50 [SEVERE]    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    >
    
    The Event:
    Code:
    @EventHandler
    public void onPLayerJoin(PlayerJoinEvent e) {
      Player p = e.getPlayer();
        try {
          URL url = new URL("http://skins.goldencreate.com/saveskin.php?user=" + p.getName());
          URLConnection myc = url.openConnection();
          myc.connect();
        } catch(MalformedURLException ec) {
          ec.printStackTrace();
        } catch(IOException el) {
          el.printStackTrace();
        }
    }
     
  2. Offline

    RealDope

    As the error says, the connection is refused. Are you sure the server you're connecting to is up?
     
Thread Status:
Not open for further replies.

Share This Page