Results 1 to 5 of 5
  1. #1
    trusiekpt is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default need help with java nested exception.

    I have created client-server gui calendar application in eclipse but it doesn't work. I have such a strange exception.. Can someone help me to solve it. As a server I used mysql and fat jar plugin for eclipse to make runnable jar file.

    com.mysql.jdbc.CommunicationsException: Communications link failure due
    to underlying exception:

    ** BEGIN NESTED EXCEPTION **

    java.net.ConnectException
    MESSAGE: Connection refused

    STACKTRACE:

    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:351)
    at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:213)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:200)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.j ava:366)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:478)
    at java.net.Socket.<init>(Socket.java:375)
    at java.net.Socket.<init>(Socket.java:218)
    at
    com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
    at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2771)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1 555)
    at
    com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager .java:582)
    at java.sql.DriverManager.getConnection(DriverManager .java:185)
    at
    calendarapplication.gui.CalendarApplication.main(C alendarApplication.java:40)


    ** END NESTED EXCEPTION **



    Last packet sent to the server was 2 ms ago.
    at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2847)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1 555)
    at
    com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager .java:582)
    at java.sql.DriverManager.getConnection(DriverManager .java:185)
    at
    calendarapplication.gui.CalendarApplication.main(C alendarApplication.java:40)
    Exception in thread "main" java.lang.NullPointerException
    at
    calendarapplication.gui.CalendarApplication.main(C alendarApplication.java:63)


    Regards,

  2. #2
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    It appears that the server is not allowing the client to connect. This could be because the port is wrong, or the network is not configured properly, or a firewall won't allo w the connection through, or no server is configured at all.

  3. #3
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    MySQL also needs to be configured to accept connections from whatever machine you are making them from.

  4. #4
    trusiekpt is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    But I am using default settings url - localhost, port - 3306, user - root, no password. What do you mean Tolls? How to do it? What I should change?

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,792
    Rep Power
    19

    Default

    MySQL (IIRC) needs external (that includes localhost) access to be configured for a user.
    Depending on your setup you might need to open up MySQL for <username>@localhost as well as <username>@127.0.0.1.

    As to how exactly you'll have to refer to the MySQL documentation for you version, but this is the 5.5 doc.

Similar Threads

  1. Replies: 1
    Last Post: 02-06-2011, 05:38 AM
  2. Itext with java : PDF nested table issues.. Please help
    By akbjavauser in forum Advanced Java
    Replies: 1
    Last Post: 07-14-2010, 05:43 PM
  3. Nested Loops for Java
    By soccer_kid_6 in forum New To Java
    Replies: 4
    Last Post: 02-21-2010, 05:27 AM
  4. JAVA: String char removal with nested loop
    By igniteflow in forum New To Java
    Replies: 3
    Last Post: 11-28-2008, 02:09 AM
  5. Getting unmarshaling return; nested exception
    By K.kannan in forum Advanced Java
    Replies: 0
    Last Post: 03-27-2008, 08:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •