Java Database Connectivity (JDBC) - com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying except
前陣子在處理某人丟給我要我修改的一支 Java Server Page 程式,花了一些時間安裝配置好JSP的執行環境和開發環境後,開啟網頁要測試關鍵字搜尋時卻顯示一片空白,但 Tomcat 好像無法跟 Rails 的 Mongrel Server 一樣可以從 Terminal 即時瀏覽輸出訊息,所以只好去查看/var/log/tomcat6/catalina.out記錄檔,之後找到如下的錯誤訊息: 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.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384) at java.net.Socket.connect(Socket.java:546) at java.net.Socket.connect(Socket.java:495) at java.net.Socket. (Socket.java:392) at java.net.Socket. (Socket.java:235) at com.mysql