Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

scm_prepare_database.sh unable to find MySQL JDBC driver

avatar
Explorer

Hello,

 

I was going through the Deploying CDH on Microsoft Azure Using Cloudera Manager & Azure Marketplace course, at the "Path B: Deploying Cloudera Manager for a Production Grade Cluster", but i am unable to finish th installation due to the bellow error:

"JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
Verifying that we can write to /etc/cloudera-scm-server
[ main] DbProvisioner ERROR Unable to find the MySQL JDBC driver. Please make sure that you have installed it as per instruction in the installation guide.
[ main] DbProvisioner ERROR Stack Trace:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)[:1.8.0_191]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)[:1.8.0_191]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)[:1.8.0_191]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_191]
at java.lang.Class.forName0(Native Method)[:1.8.0_191]
at java.lang.Class.forName(Class.java:264)[:1.8.0_191]
at com.cloudera.enterprise.dbutil.DbProvisioner.executeSql(DbProvisioner.java:283)[db-common-5.15.1.jar:]
at com.cloudera.enterprise.dbutil.DbProvisioner.doMain(DbProvisioner.java:104)[db-common-5.15.1.jar:]
at com.cloudera.enterprise.dbutil.DbProvisioner.main(DbProvisioner.java:123)[db-common-5.15.1.jar:]
--> Error 1, giving up (use --force if you wish to ignore the error)" 

 

I have done everything according to the tutorial videos, also checked user rights, tables, database, but the command will not work. After i run the below command, i receive the above error.

 

"/usr/share/cmf/schema/scm_prepare_database.sh mysql -h mysql -utemp -ptemp --scm-host clouderamanager scm scm_user scm_pwd"

 

The only differences between my setup and the one from the video, is that i use Java 8u191instead of Java 8u171, and my MySQL database is called mysql and not mysqlh.

 

Any advice?

Thank you!

 

 

7 REPLIES 7

avatar
The error indicates your server does not have a jdbc driver. Try to install mysql on your host, it should deploy the JDBC driver. For example on Redhat/Centos:

sudo yum -y install mysql-connector-java

Then your driver is located here:

/usr/share/java/mysql-connector-java.jar

avatar
Explorer

Hi,

 

I have done as per the instructons (from course Configuring a MySQL Database for Your Environment), and i have downloaded the driver from "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz", and then:

"mkdir -p /usr/share/java/

tar zxvf mysql-connector-java-5.1.46.tar.gz

cp mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar"

 

Is there anything else i might have forgotten? 

Thank you!

 

 

avatar

Hi,

 I think installing it via system package manager is a better solution, but in your case I miss a command to change PATH variable. So basically you downloaded, extracted the jdbc driver, but it is not visible. Make it visible system wide by changing your env variables, or put this jdbc driver into a directory where you PATH is pointing to.

 

avatar
Explorer

Hi,

Strange is that i did it all according to the tutorial, but i think i have forgoten to put the Java connector in all nodes, that includes the cloudera manager VM. Now that i have done the same on the cloudera VM, as on the MySQL VM, and run again the prepare database, i get a different error:

"

JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
Verifying that we can write to /etc/cloudera-scm-server
[ main] DbProvisioner ERROR Exception when creating/dropping database with user 'temp' and jdbc url 'jdbc:mysql://mysql/?useUnicode=true&characterEncoding=UTF-8'
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_191]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_191]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_191]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_191]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2221)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2016)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)[mysql-connector-java.jar:5.1.46]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_191]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_191]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_191]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_191]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)[mysql-connector-java.jar:5.1.46]
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)[mysql-connector-java.jar:5.1.46]
at java.sql.DriverManager.getConnection(DriverManager.java:664)[:1.8.0_191]
at java.sql.DriverManager.getConnection(DriverManager.java:247)[:1.8.0_191]
at com.cloudera.enterprise.dbutil.DbProvisioner.executeSql(DbProvisioner.java:296)[db-common-5.15.1.jar:]
at com.cloudera.enterprise.dbutil.DbProvisioner.doMain(DbProvisioner.java:104)[db-common-5.15.1.jar:]
at com.cloudera.enterprise.dbutil.DbProvisioner.main(DbProvisioner.java:123)[db-common-5.15.1.jar:]
[ main] DbProvisioner ERROR Stack Trace:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

--> Error 1, giving up (use --force if you wish to ignore the error)"

 

avatar
You have something definitely wrong in the configuration:
Is the host running the mysql database called really "mysql" ? (Because your JDBC connect string looks like this).

Can you do the following:
Get the MYSQL server hostname
Get the MYSQL root username and password
And try from every host:
mysql -h <MYSQLHOSTNAME> -u <ROOTUSER> -p

If you are able to connect, then your database is accesible from every node.

avatar
Explorer

I am sure that i did something wrong. My VM running the MySQL, the host is called "mysql", it was installed and root credentials were given by me.

When trying to run the "mysql -h mysql -u root -p" i get the "-bash: mysql: command not found".

Where did i go wrong? because i did the same things as in the tutorials 😞 

 

avatar
Explorer

Hi,

 

After further troubleshooting and testing different scenarios, i managed to fix the issue. First i replaced the temp user with root user, the mysql hostname with the IP address, but this still did not work. As a solution, on the MySQL machine, i ran the bellow command:

 

"grant all privileges on *.* TO 'root'@'%' identified by 'password' with grant option;Flush privileges;"

 

After that, the command "/usr/share/cmf/schema/scm_prepare_database.sh mysql -h IPADDRESS -uroot -p --scm-host clouderamanager scm scm_user scm_pwd" worked and now the service is up and running.

 

Thank you for the assistance!