cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

 问题现象

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

 

    查看

[[email protected] cloudera-scm-server]# pwd
/var/log/cloudera-scm-server
[[email protected] cloudera-scm-server]# cat cloudera-scm-server.log 

 

     是如下的问题:

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397)
    at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:62)
    at com.cloudera.enterprise.AbstractWrappedEntityManager.beginForRollbackAndReadonly(AbstractWrappedEntityManager.java:89)
    at com.cloudera.enterprise.dbutil.DbUtil.isInnoDbEnabled(DbUtil.java:549)
    at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.checkMysqlTableEngineType(EntityManagerFactoryBean.java:139)
    at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:122)
    at com.cloudera.server.cmf.bootstrap.EntityManagerFactoryBean.getObject(EntityManagerFactoryBean.java:65)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 22 more
Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157)
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1426)
    at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59)
    ... 28 more
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
    at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
    at org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:84)
    at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214)
    ... 33 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:1319)
    at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
    ... 37 more
2017-12-02 19:59:55,633 INFO main:com.cloudera.server.cmf.Main: Starting SCM Server. JVM Args: [-Dlog4j.configuration=file:/etc/cloudera-scm-server/log4j.properties, -Dfile.encoding=UTF-8, -Dcmf.root.logger=INFO,LOGFILE, -Dcmf.log.dir=/var/log/cloudera-scm-server, -Dcmf.log.file=cloudera-scm-server.log, -Dcmf.jetty.threshhold=WARN, -Dcmf.schema.dir=/usr/share/cmf/schema, -Djava.awt.headless=true, -Djava.net.preferI
cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

 

 

 

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...
[[email protected] lib]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1262/rpcbind        
tcp        0      0 0.0.0.0:4433                0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 0.0.0.0:52338               0.0.0.0:*                   LISTEN      1390/rpc.statd      
tcp        0      0 127.0.0.1:7190              0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1579/sshd           
tcp        0      0 0.0.0.0:7191                0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1417/cupsd          
tcp        0      0 127.0.0.1:19001             0.0.0.0:*                   LISTEN      1894/python         
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1683/master         
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2263/sshd           
tcp        0      0 127.0.0.1:6011              0.0.0.0:*                   LISTEN      2689/sshd           
tcp        0      0 192.168.80.31:9000          0.0.0.0:*                   LISTEN      1739/python2.6      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3183/mysqld         
tcp        0      0 :::111                      :::*                        LISTEN      1262/rpcbind        
tcp        0      0 :::4434                     :::*                        LISTEN      1976/python2.6      
tcp        0      0 :::22                       :::*                        LISTEN      1579/sshd           
tcp        0      0 :::7191                     :::*                        LISTEN      1976/python2.6      
tcp        0      0 ::1:631                     :::*                        LISTEN      1417/cupsd          
tcp        0      0 ::1:25                      :::*                        LISTEN      1683/master         
tcp        0      0 :::59833                    :::*                        LISTEN      1390/rpc.statd      
tcp        0      0 ::1:6010                    :::*                        LISTEN      2263/sshd           
tcp        0      0 ::1:6011                    :::*                        LISTEN      2689/sshd       
cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

 

 

 

 

 

 

 

 

 

 

解决办法

 cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

[[email protected] lib]# service mysqld start
Starting mysqld:                                           [  OK  ]
[[email protected] lib]# 

 

 

 

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...
[[email protected] lib]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:7180                0.0.0.0:*                   LISTEN      3309/java           
tcp        0      0 0.0.0.0:7182                0.0.0.0:*                   LISTEN      3309/java           
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1262/rpcbind        
tcp        0      0 0.0.0.0:4433                0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 0.0.0.0:52338               0.0.0.0:*                   LISTEN      1390/rpc.statd      
tcp        0      0 127.0.0.1:7190              0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1579/sshd           
tcp        0      0 0.0.0.0:7191                0.0.0.0:*                   LISTEN      1976/python2.6      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1417/cupsd          
tcp        0      0 127.0.0.1:19001             0.0.0.0:*                   LISTEN      1894/python         
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1683/master         
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2263/sshd           
tcp        0      0 127.0.0.1:6011              0.0.0.0:*                   LISTEN      2689/sshd           
tcp        0      0 192.168.80.31:9000          0.0.0.0:*                   LISTEN      1739/python2.6      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3183/mysqld         
tcp        0      0 :::111                      :::*                        LISTEN      1262/rpcbind        
tcp        0      0 :::4434                     :::*                        LISTEN      1976/python2.6      
tcp        0      0 :::22                       :::*                        LISTEN      1579/sshd           
tcp        0      0 :::7191                     :::*                        LISTEN      1976/python2.6      
tcp        0      0 ::1:631                     :::*                        LISTEN      1417/cupsd          
tcp        0      0 ::1:25                      :::*                        LISTEN      1683/master         
tcp        0      0 :::59833                    :::*                        LISTEN      1390/rpc.statd      
tcp        0      0 ::1:6010                    :::*                        LISTEN      2263/sshd           
tcp        0      0 ::1:6011                    :::*                        LISTEN      2689/sshd           
[[email protected] lib]# 
cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

     其实,这个问题很简单,是mysql方面的问题,要么是mysql服务没启动,要么就是你的驱动jar包没安装好。

 

 

 

cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

[[email protected] lib]# pwd
/usr/share/cmf/lib
[[email protected] lib]# 

 

 

 cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.G...

 

 

 

 

 建议

    要将mysqld设置为开机自动启动:

  chkconfig mysqld on

  可能还会出现情况,就是JDBC driver cannot be found,这时把jar包复现到 /usr/share/cmf/lib 下就行了。 
重启cloudera-scm-server服务。 
等待1分钟,访问7180端口,应该就不会出问题了。


本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/7944257.html,如需转载请自行联系原作者