title: Flink: java.lang.ClassNotFoundException: org.apache.flink.api.common.serialization.DeserializationSchema
body: <p>Using Flink to consume data from AWS Kinesis.</p>
  
  <p>My codes:</p>
  
  <pre><code>public class kinesisConsumer {
  public static void main(String[] args) throws Exception {
      Properties kinesisConsumerConfig = new Properties();
      kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_REGION, "cn-northwest-1");
      kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_ACCESS_KEY_ID, "aaa");
      kinesisConsumerConfig.setProperty(ConsumerConfigConstants.AWS_SECRET_ACCESS_KEY, "bbb");
      kinesisConsumerConfig.put(ConsumerConfigConstants.STREAM_INITIAL_POSITION, "LATEST");
  
      StreamExecutionEnvironment see = StreamExecutionEnvironment.getExecutionEnvironment();
  
      DataStream&lt;String&gt; kinesis = see.addSource(new FlinkKinesisConsumer&lt;&gt;(
              "test_data",
              new SimpleStringSchema(),
              kinesisConsumerConfig));
  
      kinesis.print();
  
      see.execute();
      }
  }
  </code></pre>
  
  <p>My pom file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.ne&lt;/groupId&gt;
      &lt;artifactId&gt;kinesis&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.7.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                              &lt;mainClass&gt;kinesisConsumer&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
              &lt;artifactId&gt;flink-java&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
              &lt;artifactId&gt;flink-streaming-java_2.11&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.flink&lt;/groupId&gt;
              &lt;artifactId&gt;flink-clients_2.11&lt;/artifactId&gt;
              &lt;version&gt;1.6.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;2.5.2&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Also I download and add the <code>flink-connector-kinesis_2.11-1.6.2.jar</code> into the library.</p>
  
  <p>Then I package it using: <code>mvn -DskipTests package</code>. But when I run the jar it returns:</p>
  
  <pre><code>    Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/flink/api/common/serialization/DeserializationSchema
              at java.lang.Class.getDeclaredMethods0(Native Method)
              at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
              at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
              at java.lang.Class.getMethod0(Class.java:3018)
              at java.lang.Class.getMethod(Class.java:1784)
              at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
              at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
      Caused by: java.lang.ClassNotFoundException: org.apache.flink.api.common.serialization.DeserializationSchema
              at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
              ... 7 more
  </code></pre>
  
  <p><strong>My questions are:</strong></p>
  
  <ol>
  <li><p>Why does this error occur and how to address it?</p></li>
  <li><p>I am consuming the data and then print it, not saving it to the disk, why the program use serialization codes?</p></li>
  </ol>
  
  <p>Any help is appreciated.</p>