我试图在此处找到的Kinesis Streams上运行以下AWS教程,http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-consumer.html,项目的Producer部分(StockTradesWriter.java)运行正常,但我得到以下内容我尝试运行项目的Consumer部分(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
因此,由于某种原因无法找到此课程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和AWS SDK for Java版本1.11.7。这是我的Eclipse的屏幕截图项目:
注意:要下载并运行此程序,您可以在此必备页面上找到所需的一切:http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-begin.html