Hadoop does not load jdbc driver

2015-05-29T13:06:49

I am writing a program in Hadoop, which uses MySql to read data from dfs. I get this message upon run:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at ConnectDtb.<init>(ConnectDtb.java:14)
    at WriteToDtb.<init>(WriteToDtb.java:14)
    at WriteToDtb.main(WriteToDtb.java:61)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

When I run it without Hadoop, I'm not getting this error.

I have put mysql-connector.jar to $Hadoop/lib, tried to run with -libjars <mysql-connector path> but it fails as well.

Copyright License:
Author:「Copper」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/30521514/hadoop-does-not-load-jdbc-driver

About “Hadoop does not load jdbc driver” questions

I am writing a program in Hadoop, which uses MySql to read data from dfs. I get this message upon run: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader.findCl...
I created a SQL table and I am trying to import it data by using Sqoop to hdfs. But when I run sqoop import command, I am getting the following error. This is the command: hduser@ubuntu:~$sqoop
I am getting the same error as in exception is java.lang.IllegalStateException: Could not load JDBC driver class. I have added ojdbc14.jar inside src/main/resources/lib. Still getting:-
I have an application which purpose is to support JDBC connections for jdbc:hive:// and jdbc:hive2:// protocols. The following code loads the corresponding JDBC drivers for both protocols: private...
I’m trying to connect a Java program to a remote Oracle DB. After doing some research online, I decided that the easiest way to do this was with the Oracle JDBC driver. I downloaded and ran the jar...
I'm trying to load the JDBC driver dynamically with this kind of code: try{ URL[] url={new URL("file:libs/mysql-connector-java-5.1.21.jar")}; URLClassLoader loader = new
I am working with the BIRT Report Design Feature that is built into eclipse. I am using this to develop a report for an application we use at work. In BIRT, I added a data source which would be the
I am getting below error while trying to connect to a drillbit instance running on my RHEL box from DBeaver installed on my windows machine . Can't create driver instance Error creating driver 'Had...
I am trying to import data from the sybaseIQ using sqoop-1. The jdts-1.3.1.jar is placed on /sqoop/sqoop-1.4.6/lib folder. When this syntax runs, sqoop import --connect '`jdbc:jtds:sybase:td...
I was wondering if someone could give me some instructions on how to do the following: How to add mysql connection JAR file to the Eclipse plugin build path How to add the connector JAR file as l...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.