Abhishek Choudhary
Abhishek Choudhary

Reputation: 8395

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

Upvotes: 0

Views: 2038

Answers (3)

Crackerman
Crackerman

Reputation: 733

I ran into this issue when I was converting my local Derby instance to MySql. The difference between my issue and the others, is that I did not install an RPM. My Oozie instance was pre-compiled in a tar.gz file. I had to copy the mysql-connector-java-bin.jar to the oozie-server/lib directory. This was in addition to copying it to the lib, libext, and libtools directories. I am not sure if all of those are needed, but I do know that oozie-server/lib is needed for Oozie to start. Hope this helps someone!

Upvotes: 0

Chen Linlin
Chen Linlin

Reputation: 31

i meet the same problem finally i solve it by edit the oozie-env.sh and append the JAVA_HOME at last export JAVA_HOME=/usr/local/jdk1.7 the java_home is yourself javapath

Upvotes: 0

SachinJose
SachinJose

Reputation: 8522

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.

Upvotes: 1

Related Questions