Kettle: pentaho-server-ce-9.4 : ERROR [SchemaUpdate] could not get database metadata
PENTAHO-SERVER-CE-9.4 + MYSQL 8.0.35 + JDK1.8 :启动 提示日志内容(部分):
Using CATALINA_BASE: "D:\Programs\pentaho-server\tomcat"
Using CATALINA_HOME: "D:\Programs\pentaho-server\tomcat"
Using CATALINA_TMPDIR: "D:\Programs\pentaho-server\tomcat\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_101"
Using CLASSPATH: "D:\Programs\pentaho-server\tomcat\bin\bootstrap.jar;D:\Programs\pentaho-server\tomcat\bin\tomcat-juli.jar"
10:32:28,057 INFO [PeriodicStatusLogger] Caution, the system is initializing. Do not shut down or restart the system at this time.
10:32:28,559 INFO [OSGIBoot] Checking to see if org.pentaho.clean.karaf.cache is enabled
10:32:38,932 INFO [KarafInstance]
*******************************************************************************
*** Karaf Instance Number: 1 at D:\Programs\pentaho-server\pentaho-solution ***
*** s\system\karaf\caches\default\data-1 ***
*** Karaf Port:8802 ***
*** OSGI Service Port:9051 ***
*** JMX RMI Registry Port:11099 ***
*** RMI Server Port:44445 ***
*******************************************************************************
10:32:49,951 ERROR [SchemaUpdate] could not get database metadata
java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:168)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:375)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.pentaho.platform.repository.hibernate.HibernateUtil.initialize(HibernateUtil.java:171)
at org.pentaho.platform.repository.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:92)
at org.pentaho.cdf.environment.configurations.PentahoHibernanteConfigurations.getConfiguration(PentahoHibernanteConfigurations.java:30)
at org.pentaho.cdf.utils.PluginHibernateUtil.initialize(PluginHibernateUtil.java:58)
at org.pentaho.cdf.storage.StorageEngine.<clinit>(StorageEngine.java:39)
at org.pentaho.cdf.storage.StorageApi.<init>(StorageApi.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
解决方式:
可通过增加如下参数允许客户端获得服务器的公钥:
1、在 JDBC 连接串中加入 allowPublicKeyRetrieval=true 参数;
2、在 CLI 客户端连接时加入–get-server-public-key 参数;
例如:
主要是针对如下配置文件的修改:applicationContext-spring-security-jdbc.xml;applicationContext-spring-security-hibernate.properties;hibernate-settings.xml;mysql5.hibernate.cfg.xml以及对\META-INF\context.xml文件的修改
<Resource name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxActive="20" minIdle="0" maxIdle="5" initialSize="0"
maxWait="10000" username="hibuser" password="password"
driverClassName="com.mysql.cj.jdbc.Driver" url="jdbc:mysql://localhost:3306/hibernate?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true"
validationQuery="select user() " />
Quartz/type=javax.sql.DataSource
Quartz/driver=com.mysql.cj.jdbc.Driver
Quartz/url=jdbc:mysql://localhost:3306/quartz?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
Quartz/user=pentaho_user
Quartz/password=password