报错背景:

执行hdfs-mysql的job任务的时候报错。

报错现象:

报错:java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException_Sqoop2报错:java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException_CDH_02

Exception has occurred during processing command 
Exception: org.apache.sqoop.common.SqoopException Message: CLIENT_0001:Server has returned exception - <html><head><title>Apache Tomcat/6.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Servlet execution threw an exception</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Servlet execution threw an exception</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet execution threw an exception
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:631)
    org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.doFilter(DelegationTokenAuthenticationFilter.java:301)
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:579)
</pre></p><p><b>root cause</b> <pre>java.lang.NoClassDefFoundError: org/codehaus/jackson/map/JsonMappingException
    org.apache.hadoop.mapreduce.Job.getJobSubmitter(Job.java:1291)
    org.apache.hadoop.mapreduce.Job.submit(Job.java:1302)
    org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.submitToCluster(MapreduceSubmissionEngine.java:274)
    org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.submit(MapreduceSubmissionEngine.java:255)
    org.apache.sqoop.driver.JobManager.start(JobManager.java:288)
    org.apache.sqoop.handler.JobRequestHandler.startJob(JobRequestHandler.java:380)
    org.apache.sqoop.handler.JobRequestHandler.handleEvent(JobRequestHandler.java:116)
    org.apache.sqoop.server.v1.JobServlet.handlePutRequest(JobServlet.java:96)
    org.apache.sqoop.server.SqoopProtocolServlet.doPut(SqoopProtocolServlet.java:79)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:631)
    org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.doFilter(DelegationTokenAuthenticationFilter.java:301)
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:579)
</pre></p><p><b>root cause</b> <pre>java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException
    java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    org.apache.hadoop.mapreduce.Job.getJobSubmitter(Job.java:1291)
    org.apache.hadoop.mapreduce.Job.submit(Job.java:1302)
    org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.submitToCluster(MapreduceSubmissionEngine.java:274)
    org.apache.sqoop.submission.mapreduce.MapreduceSubmissionEngine.submit(MapreduceSubmissionEngine.java:255)
    org.apache.sqoop.driver.JobManager.start(JobManager.java:288)
    org.apache.sqoop.handler.JobRequestHandler.startJob(JobRequestHandler.java:380)
    org.apache.sqoop.handler.JobRequestHandler.handleEvent(JobRequestHandler.java:116)
    org.apache.sqoop.server.v1.JobServlet.handlePutRequest(JobServlet.java:96)
    org.apache.sqoop.server.SqoopProtocolServlet.doPut(SqoopProtocolServlet.java:79)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:631)
    org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.doFilter(DelegationTokenAuthenticationFilter.java:301)
    org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:579)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/6.0.53 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.53</h3></body></html>

报错原因:

java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException

找不到这个类

报错解决:

jackson-core-asl-1.8.8.jarjackson-mapper-asl-1.8.8.jar 这两个jar包移动到指定目录下 /var/lib/sqoop2

jar包位置:/opt/cloudera/parcels/CDH-5.15.1-1.cdh5.15.1.p0.4/jars

cp jackson-core-asl-1.8.8.jar jackson-mapper-asl-1.8.8.jar /var/lib/sqoop2