首页 > 代码库 > Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:

Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:

七月 17, 2014 4:56:01 下午 org.apache.catalina.core.StandardWrapperValve invokeSEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)### The error may exist in ***.xml### The error may involve com.supervisory.dao.SecurityServiceDao.selectUserLogin### The error occurred while executing a query### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)] with root causejava.sql.SQLException: Io 异常: The Network Adapter could not establish the connection    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)    at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)    at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80)    at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:66)    at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:279)    at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:69)    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56)    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141)    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101)    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:95)    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:59)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:601)    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)    at com.sun.proxy.$Proxy6.selectOne(Unknown Source)    at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:95)    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)    at com.sun.proxy.$Proxy8.selectUserLogin(Unknown Source)    at com.supervisory.service.impl.SecurityServiceImpl.selectUserLogin(SecurityServiceImpl.java:42)    at com.supervisory.web.security.LoginAction.handleRequest(LoginAction.java:71)    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at java.lang.Thread.run(Thread.java:722)

发现结果是网络不通导致的.因为是在远程需要vpn. 碰到此问题可以先检查下网络