gpt4 book ai didi

java - AWS Kinesis 客户端因 java.lang.NoClassDefFoundError 失败

转载 作者:行者123 更新时间:2023-11-29 04:44:38 25 4
gpt4 key购买 nike

我正在关注 http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one.html Kinesis Streams 教程。

我创建了两个包,一个包含生产者,一个包含消费者。我可以正确地生成数据,并且可以从指标仪表板中看到数据正在进入流中。

当我运行我的消费者时,我得到以下堆栈跟踪:

1246 [main] DEBUG com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor  - 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(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at com.amazonaws.services.kinesis.leases.impl.LeaseManager.createLeaseIfNotExists(LeaseManager.java:281)
at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ShardSyncer.syncShardLeases(ShardSyncer.java:127)
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:102)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.util.json.JSONObject
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more

最佳答案

我刚遇到同样的问题。只需将 aws-sdk 的版本更改为 1.10.x。我用的是 1.10.7可能您正在使用 aws-sdk 版本 1.11.x

关于java - AWS Kinesis 客户端因 java.lang.NoClassDefFoundError 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37734500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com