Closed guoxuhui closed 6 years ago
能否贴一下相关的堆栈信息,还有,JDK版本,Tomcat版本是多少?
你是哪个版本的dal-client?要不你到qq群307228594里面来,我们帮你看看
jdk1.7 tomcat7 与 jdk1.8 tomcat8 都测试过,不行
`[ INFO][12-20 20:05:56.900][http-bio-8080-exec-1][DAL Java Client 1.14.0:74]-Successfully initialized Dal Java Client Factory
[ INFO][12-20 20:05:57.010][http-bio-8080-exec-1][DAL Java Client 1.14.0:197]-start request
[ INFO][12-20 20:05:57.012][http-bio-8080-exec-1][DAL Java Client 1.14.0:31]-Start Task: N/A
[ INFO][12-20 20:05:57.017][http-bio-8080-exec-1][com.ctrip.platform.dal.dao.datasource.SingleDataSource:51]-Datasource[name=dao, Driver=null] created.
[ INFO][12-20 20:05:57.112][http-bio-8080-exec-1][com.ctrip.platform.dal.dao.datasource.SingleDataSource:56]-Datasource[name=dao, Driver=null] created.
Dec 20, 2017 8:05:57 PM org.apache.tomcat.jdbc.pool.ConnectionPool init
严重: Unable to create initial connections of pool.
java.sql.SQLException
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 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.
[ERROR][12-20 20:05:57.143][http-bio-8080-exec-1][com.ctrip.platform.dal.dao.datasource.SingleDataSource:60]-Error creating pool for data source dao
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 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.
这个是1.14.0的bug。没有对基于datasource.xml的数据库连接配置做支持。我们后面会发个1.14.1来fix这个issue。目前可以用外部properties文件的方式继续使用1.14.0或切换到1.13.x
您好,试了一下1.14.1还是有这个问题。 PoolProperties里参数是空的,导致了后面解析jdbc字符串的时候报错反射找不到mysql类。
信息: Server startup in 2786 ms
[ INFO][01-16 10:32:48.180][http-bio-8000-exec-1][com.ctrip.platform.dal.dao.configure.DataSourceConfigureParser:51]-datasource property will use file :/home/yeon/env/tomcat/apache-tomcat-7.0.61/webapps/ROOT/WEB-INF/classes/datasource.xml
[ INFO][01-16 10:32:48.186][http-bio-8000-exec-1][DAL Java Client 1.14.1:74]-Successfully initialized Dal Java Client Factory
[ INFO][01-16 10:32:48.209][http-bio-8000-exec-1][com.ctrip.platform.dal.dao.datasource.SingleDataSource:54]-pool properties: ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=null; maxActive=100; maxIdle=100; minIdle=0; initialSize=1; maxWait=10000; testOnBorrow=true; testOnReturn=false; timeBetweenEvictionRunsMillis=5000; numTestsPerEvictionRun=0; minEvictableIdleTimeMillis=30000; testWhileIdle=false; testOnConnect=false; password=****; url=null; username=null; validationQuery=SELECT 1; validationQueryTimeout=5; validatorClassName=com.ctrip.platform.dal.dao.datasource.DataSourceValidator; validationInterval=30000; accessToUnderlyingConnectionAllowed=true; removeAbandoned=true; removeAbandonedTimeout=65; logAbandoned=false; connectionProperties=null; initSQL=null; jdbcInterceptors=org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer; jmxEnabled=true; fairQueue=true; useEquals=true; abandonWhenPercentageFull=0; maxAge=28000000; useLock=false; dataSource=null; dataSourceJNDI=null; suspectTimeout=0; alternateUsernameAllowed=false; commitOnReturn=false; rollbackOnReturn=false; useDisposableConnectionFacade=true; logValidationErrors=false; propagateInterruptState=false; ignoreExceptionOnPreLoad=false;
[ INFO][01-16 10:32:48.210][http-bio-8000-exec-1][com.ctrip.platform.dal.dao.datasource.SingleDataSource:57]-Prepare Datasource[name=dao, Driver=null]
一月 16, 2018 10:32:48 上午 org.apache.tomcat.jdbc.pool.ConnectionPool init
严重: Unable to create initial connections of pool.
java.sql.SQLException
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 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.
换了1.13.1,正常。
我们已经更新到最新的1.14.2版本,本地test case通过,你再试一下,如果仍旧不行,加我们的QQ群,我们帮你看一下是哪里的配置问题。
我首先也出现这样的错误,然后加了mysql-connector-java包,就OK啦
首次安装后,提示连接失败,查看日志提示Unable to create initial connections of pool. Datasource[name=dao, Driver=null] created.
但是数据库配置文件是没错的
<Datasource name="dao" userName="root" password="123456" connectionUrl="jdbc:mysql://127.0.0.1:3306/CodeGen" driverClassName="com.mysql.jdbc.Driver"/>