1

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 dueto 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(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java: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(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at calendarapplication.gui.CalendarApplication.main(CalendarApplication.java:40)

END NESTED EXCEPTION

Last packet sent to the server was 2 ms ago.

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2847)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at calendarapplication.gui.CalendarApplication.main(CalendarApplication.java:40)

Exception in thread "main" java.lang.NullPointerException
at calendarapplication.gui.CalendarApplication.main(CalendarApplication.java:63)

Regards,

1
  • 1
    how does your jdbc configuration look like? i mean, which server/port you are trying to connect to? from the stacktrace, it seems that you are trying to connect to a server that you have either no access or is not running mysql. Commented Feb 28, 2011 at 21:13

2 Answers 2

2

Check your JDBC connection string to make sure you have correct port number. By default MySQL runs on 3306. You can verify it by using >netstat -b command

Sign up to request clarification or add additional context in comments.

Comments

0

Looks like your server (mysql) is not started at specified address and port.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.