CDH报错:PersistenceException: [PersistenceUnit: cmf.server] Unable to build EntityManagerFactory

1.在启动CDH中master的服务cloudera-scm-server start并立刻挂掉了,提示如下错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cloudera.server.cmf.TrialState': Cannot resolve reference to bean 'entityManagerFactoryBean' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactoryBean': FactoryBean threw exception on object creation; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: cmf.server] Unable to build EntityManagerFactory
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)

 

2.问题出现的原因,是因为连接到mysql的scm库出错了。

①首先查看连接到mysql的scm库的配置文件db.properties是否正常。

一般情况下位置在 /opt/cm-5.16.1/etc/cloudera-scm-server

②看看里面的配置是否正确

# The database type
# Currently 'mysql', 'postgresql' and 'oracle' are valid databases.
com.cloudera.cmf.db.type=mysql

# The database host
# If a non standard port is needed, use 'hostname:port'
com.cloudera.cmf.db.host=localhost #ip和端口

# The database name
com.cloudera.cmf.db.name=scm #库名

# The database user
com.cloudera.cmf.db.user=scm #库用户,要在数据库中确认一下用户权限

# The database user's password
com.cloudera.cmf.db.password=scm #库密码

# The db setup type
# By default, it is set to INIT
# If scm-server uses Embedded DB then it is set to EMBEDDED
# If scm-server uses External DB then it is set to EXTERNAL
com.cloudera.cmf.db.setupType=INIT #master为EXTERNAL,slave为INIT

③其实最好的测试办法,就是直接使用用户名和密码登录mysql看看是否能正常访问scm库。

 

3.重启master后可用了。

slave可能会出现下面报错:nested exception is java.lang.RuntimeException: ScmActive at bootup: Failed to validate the identity of Cloudera Manager.

在下一篇《CDH报错:ScmActive at bootup: Failed to validate the identity of Cloudera Manager.》中进行解决。

以上。

posted @ 2019-06-17 19:50  pcwen.top  阅读(1207)  评论(0编辑  收藏  举报
pcwen.top