tomcat 启动应用报错:java.sql.SQLException: Io 异常: Connection reset

客户给了几台虚拟机,要求先安装一台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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9399028/viewspace-743345/

你可能感兴趣的:(tomcat 启动应用报错:java.sql.SQLException: Io 异常: Connection reset)