配置TOMCAT连接池的问题
配置TOMCAT连接池时总是得不到连接,配置都没问题,JAR包也都放了,数据库是另一台机器,不知什么原因,JDBC也能连接通过.
Caused by:
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error
IOException: Connection refused: connect)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:315)
... 50 more
Caused by:
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.[init](ConnectionJDBC2.java:372)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.[init](ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:178)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
... 53 more
Caused by:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:289)
at net.sourceforge.jtds.jdbc.SharedSocket.[init](SharedSocket.java:250)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.[init](ConnectionJDBC2.java:297)
... 59 more
------解决方案--------------------Connection refused: connect
是不是URl写的有问题啊
------解决方案--------------------conf/Catalina/localhost 目录下建立与你工程通明的****.xml
加入
<?xml version= "1.0 " encoding= "UTF-8 "?>
<Context>
<Resource
name= "jdbc/******