7
回答
阿里云RDS Mysql5.6是否有驱动不兼容的问题(JFinal)?
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

项目中两个RDS其中一个版本为mysql5.5和另一个mysql5.6,链接5.5版本的没有问题。在连接5.6时c3p0出现No suitable driver的错误,重复多次出现同样的问题。

重复试过了多个版本的mysql驱动程序,都出现相同的问题,无论是新旧驱动都一样。

实在是相当无语了。

使用JFinal1.9开发的。

数据库配置信息,(用户名和密码没问题,用Navicat能操作数据库。)


@Override
	public void configPlugin(Plugins me) {
		//配置自動生成Model的插件
		if (getPropertyToBoolean("autoUpdateModel")) {
			me.add(new AutoModelPlugin(getProperty("jdbcUrl"),getProperty("user"), getProperty("password").trim(),
					getProperty("modelPackage"), "",getProperty("saveModelPath")));
		}
		// 配置DRUID连接池
		C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim());
//		DruidPlugin druid = new DruidPlugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim());
		AutoTableBindPlugin atbp = new AutoTableBindPlugin(c3p0Plugin);
		atbp.setShowSql(getPropertyToBoolean("showSql"));
		me.add(c3p0Plugin);
		// 配置扫描Model映射插件,自动扫描工程包中的model类进行映射
		me.add(atbp);
		//加载Ehcache缓存插件,一定要放在DruidPlugin后面,不然DruidPlugin插件无法正常启动。
		me.add(new EhCachePlugin());
	}


异常信息:

2015-07-05 03:56:32 ERROR [localhost-startStop-1] com.jfinal.core.Config  - Plugin start error: com.jfinal.ext.plugin.tablebind.AutoTableBindPlugin. 
java.sql.SQLException: Connections could not be acquired from the underlying database!
com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:48)
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:171)
at com.jfinal.ext.plugin.tablebind.AutoTableBindPlugin.start(AutoTableBindPlugin.java:196)
at com.jfinal.core.Config.startPlugins(Config.java:87)
at com.jfinal.core.Config.configJFinal(Config.java:48)
at com.jfinal.core.JFinal.init(JFinal.java:67)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:690)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:36)
... 18 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1422)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:756)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:683)
... 20 more
七月 05, 2015 3:56:32 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/XinqianliSite] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
七月 05, 2015 3:56:32 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/XinqianliSite] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-AdminTaskTimer] but has failed to stop it. This is very likely to create a memory leak.
七月 05, 2015 3:56:32 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/XinqianliSite] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#0] but has failed to stop it. This is very likely to create a memory leak.
七月 05, 2015 3:56:32 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/XinqianliSite] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#1] but has failed to stop it. This is very likely to create a memory leak.
七月 05, 2015 3:56:32 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/XinqianliSite] appears to have started a thread named [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#2] but has failed to stop it. This is very likely to create a memory leak.
七月 05, 2015 3:56:32 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\docs
七月 05, 2015 3:56:32 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\examples
七月 05, 2015 3:56:33 上午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
七月 05, 2015 3:56:33 上午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
七月 05, 2015 3:56:33 上午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@8017fd')
七月 05, 2015 3:56:33 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\host-manager
七月 05, 2015 3:56:33 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\LSEARCH_RESOURCE
七月 05, 2015 3:56:33 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\manager
七月 05, 2015 3:56:33 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\APP\Java\tomcat7.0.53\webapps\ROOT
七月 05, 2015 3:56:33 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-80"]
七月 05, 2015 3:56:33 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
七月 05, 2015 3:56:33 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 34854 ms
2015-07-05 03:57:02 WARN  [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#2] com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@119e9d2 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:278)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:172)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1814)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
2015-07-05 03:57:02 WARN  [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#2] com.mchange.v2.resourcepool.BasicResourcePool  - Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@176d97b is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2015-07-05 03:57:02 WARN  [C3P0PooledConnectionPoolManager[identityToken->1hgekjw9ap5dkey1hoj2ul|1f2f841]-HelperThread-#2] com.mchange.v2.resourcepool.BasicResourcePool  - com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@17d56ee -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: No suitable driver

帮忙瞅瞅。。。

举报
CapJes
发帖于2年前 7回/1K+阅
共有7个答案 最后回答: 2年前
异常提示无法获取连接,可能是RDS连接数达到最大值,也可能是RDS 配置有问题,异常提示与驱动无关

不会把,我们公司也在用呢,另外不推荐使用c3p0连接池。

c3p0在某些情况下经常会出现大批量的异常,推荐使用Druid,

在上家公司专门做过几款常用连接池的比较~

引用来自“JFinal”的评论

异常提示无法获取连接,可能是RDS连接数达到最大值,也可能是RDS 配置有问题,异常提示与驱动无关

用DRUID连接池也出现获取连接空指针异常。

2015-07-05 11:37:11 ERROR [localhost-startStop-1] com.jfinal.core.Config  - Plugin start error: com.jfinal.ext.plugin.tablebind.AutoTableBindPlugin. 

java.lang.NullPointerException
com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.NullPointerException
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:48)
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:171)
at com.jfinal.ext.plugin.tablebind.AutoTableBindPlugin.start(AutoTableBindPlugin.java:196)
at com.jfinal.core.Config.startPlugins(Config.java:87)
at com.jfinal.core.Config.configJFinal(Config.java:48)
at com.jfinal.core.JFinal.init(JFinal.java:67)
at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4573)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5192)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.alibaba.druid.util.JdbcUtils.getDriverClassName(JdbcUtils.java:350)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:557)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:876)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:872)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:97)
at com.jfinal.plugin.activerecord.TableBuilder.build(TableBuilder.java:36)
... 18 more

引用来自“孤独的3”的评论

不会把,我们公司也在用呢,另外不推荐使用c3p0连接池。

c3p0在某些情况下经常会出现大批量的异常,推荐使用Druid,

在上家公司专门做过几款常用连接池的比较~

Druid也出现这个问题。

引用来自“孤独的3”的评论

不会把,我们公司也在用呢,另外不推荐使用c3p0连接池。

c3p0在某些情况下经常会出现大批量的异常,推荐使用Druid,

在上家公司专门做过几款常用连接池的比较~

引用来自“CapJes”的评论

Druid也出现这个问题。
JFinal2.0 TableBuilder.java:48 这块好像是注释掉的,你用的哪个版本?

引用来自“孤独的3”的评论

不会把,我们公司也在用呢,另外不推荐使用c3p0连接池。

c3p0在某些情况下经常会出现大批量的异常,推荐使用Druid,

在上家公司专门做过几款常用连接池的比较~

引用来自“CapJes”的评论

Druid也出现这个问题。

引用来自“孤独的3”的评论

JFinal2.0 TableBuilder.java:48 这块好像是注释掉的,你用的哪个版本?
JFinal 1.9

引用来自“孤独的3”的评论

不会把,我们公司也在用呢,另外不推荐使用c3p0连接池。

c3p0在某些情况下经常会出现大批量的异常,推荐使用Druid,

在上家公司专门做过几款常用连接池的比较~

引用来自“CapJes”的评论

Druid也出现这个问题。

引用来自“孤独的3”的评论

JFinal2.0 TableBuilder.java:48 这块好像是注释掉的,你用的哪个版本?

引用来自“CapJes”的评论

JFinal 1.9

我们也是用的JFinal 1.9,RDS MySQL5.6,druid 1.0.13,mysql-connector-java 5.1.31

貌似没出现你这种报错

顶部