Support Questions
Find answers, ask questions, and share your expertise

Sqoop Db2 import Issue - Error: java.lang.ClassNotFoundException:


I am trying to connect to the DB2 database v9.1-1.

Db2 connection successfully established , but its throwing an exception like below.

16/11/07 16:37:58 INFO zookeeper.ZooKeeper: Initiating client connection, sessionTimeout=90000 watcher=org.apache.hadoop.hbase.zookeeper.PendingWatcher@77eb5790 16/11/07 16:37:58 INFO zookeeper.ClientCnxn: Opening socket connection to server xx.xx.xx.xx/xx.xx.xs.xx:2181. Will not attempt to authenticate using SASL (unknown error) 16/11/07 16:37:58 INFO zookeeper.ClientCnxn: Socket connection established to xx.xx.xx.xx/xx.xx.xs.xx:2181, initiating session 16/11/07 16:37:58 INFO zookeeper.ClientCnxn: Session establishment complete on server xx.xx.xx.xx/xx.xx.xs.xx:2181, sessionid = 0x1582ed454960c7c, negotiated timeout = 40000 16/11/07 16:37:59 INFO mapreduce.HBaseImportJob: Creating missing HBase table ABC 16/11/07 16:38:02 INFO client.HBaseAdmin: Created ABC 16/11/07 16:38:02 INFO client.ConnectionManager$HConnectionImplementation: Closing master protocol: MasterService 16/11/07 16:38:02 INFO client.ConnectionManager$HConnectionImplementation: Closing zookeeper sessionid=0x1582ed454960c7c 16/11/07 16:38:02 INFO zookeeper.ZooKeeper: Session: 0x1582ed454960c7c closed 16/11/07 16:38:02 INFO zookeeper.ClientCnxn: EventThread shut down 16/11/07 16:38:02 INFO impl.TimelineClientImpl: Timeline service address: http://xx.xx.xx.xx:8188/ws/v1/timeline/ 16/11/07 16:38:02 INFO client.RMProxy: Connecting to ResourceManager at xxx.xx.xx.xx/xx.xx.xx.xx:8050 16/11/07 16:38:02 INFO client.AHSProxy: Connecting to Application History server at xx.xx.xx.xx/xx.xx.xs.xx:10200 16/11/07 16:38:10 INFO db.DBInputFormat: Using read commited transaction isolation 16/11/07 16:38:10 INFO mapreduce.JobSubmitter: number of splits:1 16/11/07 16:38:10 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1478256182227_0007 16/11/07 16:38:11 INFO impl.YarnClientImpl: Submitted application application_1478256182227_0007 16/11/07 16:38:11 INFO mapreduce.Job: The url to track the job: 16/11/07 16:38:11 INFO mapreduce.Job: Running job: job_1478256182227_0007 16/11/07 16:38:18 INFO mapreduce.Job: Job job_1478256182227_0007 running in uber mode : false 16/11/07 16:38:18 INFO mapreduce.Job: map 0% reduce 0% 16/11/07 16:38:22 INFO mapreduce.Job: Task Id : attempt_1478256182227_0007_m_000000_0, Status : FAILED Error: java.lang.ClassNotFoundException: at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at<init>( at at at<init>( at<init>( at at java.sql.DriverManager.getConnection( at java.sql.DriverManager.getConnection( at org.apache.sqoop.mapreduce.db.DBConfiguration.getConnection( at org.apache.sqoop.mapreduce.db.DBInputFormat.getConnection( at org.apache.sqoop.mapreduce.db.DBInputFormat.setConf( at org.apache.hadoop.util.ReflectionUtils.setConf( at org.apache.hadoop.util.ReflectionUtils.newInstance( at org.apache.hadoop.mapred.MapTask.runNewMapper( at at org.apache.hadoop.mapred.YarnChild$ at Method) at at at org.apache.hadoop.mapred.YarnChild.main(

I also edited mapred-site.xml and set "" to -Xmx1024m -Ddb2.jcc.charsetDecoderEncoder=3

but still getting issue. can you please suggest what needs to check to load data from db2 to Hbase table.

sqoop import -Ddb2.jcc.charsetDecoderEncoder=3 --connect "jdbc:db2://server:port/DB/TABLE;" --username xx --password xx--table <tabname> --columns "<colnames>" --hbase-create-table --hbase-table <tabname> --column-family name --hbase-row-key name -m 1



Either you need to upgrade the DB2Driver version which supports JDK 8 or downgrade your JDK version which is supported by your DB2 Driver.

Earlier i was facing connection issue for which Jdbc drivers are copied with the DB2 version and it works. Again by copying the new version it may create an connection issue ?


check on the JDK version supported by your driver ?


clearly JDK version mismatch

Which version needs to be installed then?

I have this one installed.

Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

can you help me out how it can be resolve step b