CentOS 7 下 部署javaweb项目时MySQL: Connections could not be acquired from the underlying database!

版权声明:转载需写明出处 https://blog.csdn.net/Array_dear/article/details/79963964

MySQL java.sql.SQLException: Connections could not be acquired from the underlying database!

spring + springmvc 使用maven进行了打包
数据库链接池使用的是c3p0
在本地测试好好的没有任何问题 , 将javaweb项目发布到了服务器上 , MySQL却出错了
1. 查看 apache-tomcat/logs/localhost.2018-04-16.log 信息如下:

is java.sql.SQLException: Connections could not be acquired from the underlying database!] with root cause
 java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871)
    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)

Connections could not be acquired from the underlying database : 无法从底层数据库获得连接
检查密码链接都是对的 , 数据库属于本地访问, 不是权限问题.

网上查了许多造成的问题可解决方法

最后在Star_Ship的文章当中描述的方法解决了我的问题


解决办法: 修改c3p0.propertise的配置文件

c3p0.blogName=
c3p0.pwd=
c3p0.driverClass=com.mysql.jdbc.Driver
c3p0.jdbcUrl=jdbc:mysql://localhost:3306/test

在每个属性的前面加上c3p0.

文章地址: https://blog.csdn.net/Array_dear/article/details/79963964

求救,我重装了mysql后,系统报Connections could not be acquired from the underlying database

08-26

2011-8-26 13:58:07 org.hibernate.util.JDBCExceptionReporter logExceptionsrn严重: Connections could not be acquired from the underlying database!rn[Cause: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.rn at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)rn at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)rn at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)rn at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)rn at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)rn at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)rn at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)rn at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)rn at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)rn at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)rn at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)rn at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:558)rn at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)rn at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:125)rn at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)rn at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)rn at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)rn at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)rn at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.checkDb(ProcessEngineImpl.java:152)rn at org.jbpm.pvm.internal.processengine.SpringProcessEngine.create(SpringProcessEngine.java:70)rn at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:90)rn at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(SpringHelper.java:50)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试