tomcat 啟動應用報錯:java.sql.SQLException: Io 異常: Connection reset

xz43發表於2012-09-13
客戶給了幾臺虛擬機器,要求先安裝一臺tomcat部署個測試環境。既然是測試環境,就只需簡單安裝 jdk 和 tomcat,啟動tomcat能正常啟動。
然後,把專案war包扔到tomcat的webapps目錄下,再次啟動後,開始載入專案,不過馬上就開始報錯:
java.sql.SQLException: Io 異常: Connection reset
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
        at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
        at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:361)
        at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
        at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
        at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
        at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)
遇到這種報錯,首先想得的是資料庫連線是不是配置錯誤,防火牆是不是關閉等等。。。一一檢查,都沒發現問題。
後來,無意識看了一下hosts檔案,發現內容如下:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               panda1 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
感覺這裡設定有點問題,按自己思路設定一下,然後重啟機器。再次啟動tomcat,則能正常啟動專案,不再報錯。
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9399028/viewspace-743345/,如需轉載,請註明出處,否則將追究法律責任。

相關文章