Learning Amazon Kinesis Streams Development - java.lang.NoClassDefFoundError: com/amazonaws/util/json/JSONObject

Learning Amazon Kinesis Streams Development - java.lang.NoClassDefFoundError: com/amazonaws/util/json/JSONObject

我正在尝试 运行 此处找到的关于 Kinesis Streams 的以下 AWS 教程,http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-consumer.html,项目的生产者部分 (StockTradesWriter.java) 工作正常,但我'当我尝试 运行 项目的消费者部分 (StockTradesProcessor.java) 时出现以下错误。

Jun 13, 2016 6:03:36 PM com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor main
SEVERE: Caught throwable while processing data.
java.lang.NoClassDefFoundError: com/amazonaws/util/json/JSONObject
    at com.amazonaws.services.kinesis.leases.impl.Lease.toString(Lease.java:229)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.determineNewLeasesToCreate(ShardSyncer.java:345)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.syncShardLeases(ShardSyncer.java:121)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.checkAndCreateLeasesForNewShards(ShardSyncer.java:88)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncTask.call(ShardSyncTask.java:68)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.initialize(Worker.java:395)
    at com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker.run(Worker.java:330)
    at com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor.main(StockTradesProcessor.java:117)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.util.json.JSONObject
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 11 more

所以这个 class,http://javadox.com/com.amazonaws/aws-java-sdk-core/1.9.26/com/amazonaws/util/json/JSONObject.html,由于某种原因找不到。

我在 Eclipse 中 运行 使用 Java 8 进行此操作,我已经包含了 Kinesis Client Library (KCL) 1.6.3 版和 [=30= 的 AWS SDK ] version 1.11.7.Here 是我的Eclipse项目截图:

注意:要下载并运行此程序,您可以在此先决条件页面上找到所需的一切:http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-begin.html

显然最新的 AWS SDK (1.11.x) 不适用于本教程。我将版本降到 1.10.76,一切都开始工作了……谢谢亚马逊。

升级到 KCL v1.7.2 似乎已经为我解决了这个问题。我正在使用 AWS SDK 1.11.58。

不确定问题是何时引入或修复的