0

我正在开发一个将 Kinesis Stream 数据放入 S3 的 Kinesis 应用程序,它在内部使用 KCL(Kinesis 客户端库)。当我在本地机器上运行它时,它在 Eclipse 中运行良好。

我在 jar 文件中导出了这个项目。运行此 Jar 文件时,出现以下错误。

下面是堆栈跟踪:

    Exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/services/kinesis/clientlibrary/interfaces/IRecordProcessorFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more

以下是 pom.xml 文件:

    <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 https://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.amazonaws</groupId>
  <artifactId>amazon-kinesis-connectors-samples</artifactId>
  <packaging>jar</packaging>
  <name>Amazon Kinesis Connector Library Samples</name>
  <version>1.0.0-SNAPSHOT</version>
  <description>Samples for the Amazon Kinesis Connector Library.</description>
  <url>https://aws.amazon.com/kinesis</url>

  <scm>
    <url>https://github.com/awslabs/amazon-kinesis-connectors.git</url>
  </scm>

  <licenses>
    <license>
      <name>Amazon Software License</name>
      <url>https://aws.amazon.com/asl</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <kinesis-connector.version>1.3.0</kinesis-connector.version>
    <aws-java-sdk.version>1.11.14</aws-java-sdk.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>amazon-kinesis-connectors</artifactId>
      <version>${kinesis-connector.version}</version>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk</artifactId>
      <version>${aws-java-sdk.version}</version>
    </dependency>

    <!-- Sample Dependencies -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.3-1101-jdbc41</version>
    </dependency>
    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>1.2.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-core</artifactId>
      <version>4.8.1</version>
    </dependency>

  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.10</version>
        <executions>
          <execution>
            <id>generate-scripts</id>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <programs>
            <program>
              <mainClass>samples.dynamodb.DynamoDBExecutor</mainClass>
              <id>dynamodb-sample</id>
            </program>
            <program>
              <mainClass>samples.s3.S3Executor</mainClass>
              <id>s3-sample</id>
            </program>
            <program>
              <mainClass>samples.elasticsearch.ElasticsearchExecutor</mainClass>
              <id>elastic-search-sample</id>
            </program>
            <program>
              <mainClass>samples.redshiftbasic.RedshiftBasicExecutor</mainClass>
              <id>redshift-basic-sample</id>
            </program>
            <program>
              <mainClass>samples.redshiftmanifest.RedshiftManifestExecutor</mainClass>
              <id>redshift-manifest-sample</id>
            </program>
          </programs>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

任何帮助表示赞赏。

4

0 回答 0