Search code examples
hadoopbigdataclouderaoozie

Apache Oozie throws classnotfound exception while creating mysql DB


I am trying to use mysql DB with apache OOzie. my $OOZIE_HOME is -bash: /opt/oozie_install/oozie-3.3.0-cdh4.2.2: Is a directory

But I copied mysql-connector-java-5.1.29-bin.jar in almost every possible places. Like I copied it inside

/opt/oozie_install/oozie-3.3.0-cdh4.2.2
/opt/oozie_install/oozie-3.3.0-cdh4.2.2/libs
/opt/oozie_install/oozie-3.3.0-cdh4.2.2/libtools
/usr/lib/jvm/jdk/libs
/user/home/hadoop/

But I am still getting ClassnotFoundException.

java.lang.Exception: Could not connect to the database: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at org.apache.oozie.tools.OozieDBCLI.validateConnection(OozieDBCLI.java:473)
        at org.apache.oozie.tools.OozieDBCLI.createDB(OozieDBCLI.java:179)
        at org.apache.oozie.tools.OozieDBCLI.run(OozieDBCLI.java:118)
        at org.apache.oozie.tools.OozieDBCLI.main(OozieDBCLI.java:64)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:190)
        at org.apache.oozie.tools.OozieDBCLI.createConnection(OozieDBCLI.java:462)
        at org.apache.oozie.tools.OozieDBCLI.validateConnection(OozieDBCLI.java:469)

Exactly where am I supposed to copy the Mysql connector.

I have verified my oozie-site.xml- enter image description here

I followed the following steps to use mysql in Oozie

enter image description here

My oozie directory looks like-

enter image description here


Solution

  • You have to copy mysql-connector-java-5.1.29-bin.jar to /opt/oozie_install/oozie-3.3.0-cdh4.2.2/libext directory then restart oozie instance. Make sure that mysql user oozie has suffient privileges to the database oozie, if not, grant suffient permission using grant command in mysql server.