ctripcorp / dal

Ctrip Database Access Layer
Apache License 2.0
1.24k stars 447 forks source link

can not connection from db dao #31

Closed wenfazhu closed 6 years ago

wenfazhu commented 6 years ago

出现了 Unable to create initial connections of pool. 但是测试数据库连接时没有错误发生, setup DataBase的时候出现了 can not connection from db dao,请问下这是什么原因造成的呢?

wangyenan commented 6 years ago

看下catalina日志,里面有没有什么异常信息。

Audery commented 6 years ago

我和你报同样的错误,用IDE调试了一下,好像是数据库连接报错了,UserFilter 这个过滤器里面,但是又没查清楚具体原因。 image

wangyenan commented 6 years ago

root cause是什么能看到吗?

KevinZheng001 commented 6 years ago

报同样错,初始化配置库配置也有问题,后来手工建表,但在创建系统管理员帐号时还报相同错误,无解了 后台报错: com.ctrip.platform.dal.exceptions.DalException: Can not get connection from DB dao at com.ctrip.platform.dal.dao.client.DalConnectionManager.getConnectionFromDSLocator(DalConnectionManager.java:123) at com.ctrip.platform.dal.dao.client.DalConnectionManager.getNewConnection(DalConnectionManager.java:55) at com.ctrip.platform.dal.dao.client.DalTransactionManager.getConnection(DalTransactionManager.java:113) at com.ctrip.platform.dal.dao.client.DalTransactionManager.getConnection(DalTransactionManager.java:88) at com.ctrip.platform.dal.dao.client.DalDirectClient.getConnection(DalDirectClient.java:430) at com.ctrip.platform.dal.dao.client.DalDirectClient$1.execute(DalDirectClient.java:56) at com.ctrip.platform.dal.dao.client.DalConnectionManager._doInConnection(DalConnectionManager.java:170) at com.ctrip.platform.dal.dao.client.DalConnectionManager.doInConnection(DalConnectionManager.java:147) at com.ctrip.platform.dal.dao.client.DalDirectClient.doInConnection(DalDirectClient.java:419) at com.ctrip.platform.dal.dao.client.DalDirectClient.query(DalDirectClient.java:78) at com.ctrip.platform.dal.dao.task.QuerySqlTask.execute(QuerySqlTask.java:19) at com.ctrip.platform.dal.dao.task.DalSqlTaskRequest$SqlTaskCallable.call(DalSqlTaskRequest.java:176) at com.ctrip.platform.dal.dao.task.RequestTaskWrapper.call(RequestTaskWrapper.java:33) at com.ctrip.platform.dal.dao.task.DalRequestExecutor.nonCrossShardExecute(DalRequestExecutor.java:143) at com.ctrip.platform.dal.dao.task.DalRequestExecutor.internalExecute(DalRequestExecutor.java:121) at com.ctrip.platform.dal.dao.task.DalRequestExecutor.execute(DalRequestExecutor.java:106) at com.ctrip.platform.dal.dao.DalQueryDao.query(DalQueryDao.java:131) at com.ctrip.platform.dal.daogen.dao.DaoOfLoginUser.getUserByNo(DaoOfLoginUser.java:46) at com.ctrip.platform.dal.daogen.entity.DefaultUserInfo.getLoginUser(DefaultUserInfo.java:23) at com.ctrip.platform.dal.daogen.entity.DefaultUserInfo.getEmployee(DefaultUserInfo.java:29) at com.ctrip.platform.dal.daogen.resource.CustomizedResource.getEmployee(CustomizedResource.java:82) at com.ctrip.platform.dal.daogen.filter.UserFilter.doFilter(UserFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: null at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254) at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182) at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:727) at com.ctrip.platform.dal.dao.datasource.tomcat.DalConnectionPool.createConnection(DalConnectionPool.java:27) at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:661) at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:479) at org.apache.tomcat.jdbc.pool.ConnectionPool.(ConnectionPool.java:156) at com.ctrip.platform.dal.dao.datasource.tomcat.DalConnectionPool.(DalConnectionPool.java:20) at com.ctrip.platform.dal.dao.datasource.tomcat.DalTomcatDataSource.pCreatePool(DalTomcatDataSource.java:27) at com.ctrip.platform.dal.dao.datasource.tomcat.DalTomcatDataSource.createPool(DalTomcatDataSource.java:19) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:127) at com.ctrip.platform.dal.dao.datasource.RefreshableDataSource.getConnection(RefreshableDataSource.java:47) at com.ctrip.platform.dal.dao.datasource.DefaultDalConnectionLocator.getConnection(DefaultDalConnectionLocator.java:42) at com.ctrip.platform.dal.dao.client.DalConnectionManager.getConnectionFromDSLocator(DalConnectionManager.java:119) ... 39 common frames omitted Caused by: java.lang.NullPointerException: null at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246) ... 52 common frames omitted

wangyenan commented 6 years ago

master分支上的最新版已修复这个问题。