从Java使用LocalStack时获取AmazonKinesisException状态代码:502 [英] Getting an AmazonKinesisException Status Code: 502 when using LocalStack from Java

查看:88
本文介绍了从Java使用LocalStack时获取AmazonKinesisException状态代码:502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LocalStack编写集成测试,以模拟对Kinesis的调用.我已经创建了一个Kinesis客户端,但是当我尝试在Kinesis上放置记录时,出现错误:

I'm writing integration tests using LocalStack to mock out my calls to Kinesis. I've created a Kinesis client, but when I try to put records on Kinesis I get an error:

com.amazonaws.services.kinesis.model.AmazonKinesisException:null(服务:AmazonKinesis;状态代码:502;错误代码:null;请求ID:null)

我尝试通过以下方式禁用CBOR和证书检查:

I've tried disabling CBOR and cert checking with the following:

System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY, "false");

System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY,"true");

System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");

我以这种方式构建客户端:

I build the client this way:

.withEndpointConfiguration(localstack.getEndpointConfiguration(LocalStackContainer.Service.KINESIS))
.withCredentials(localstack.getDefaultCredentialsProvider())
.build()

我每次都得到502.S3一切正常,只是Kinesis服务给我带来了麻烦.有人看到过这样的东西吗?

I get a 502 every time. Everything works fine for S3, it's just the Kinesis service that's giving me trouble. Has anyone seen anything like this?

推荐答案

在本地通过本地堆栈连接Kinesis时,我遇到了类似的问题.我正在使用v2 SDK Java库.

I had a similar issue while connecting Kinesis over localstack locally. I was using the v2 SDK java library.

根本原因

默认情况下,kinesalite不支持CBOR,应禁用它才能使其运行.互联网上充斥着禁用CBOR的标志,但是没有一个对我有用.

By default, kinesalite doesn't support CBOR and should be disabled to make it run. Internet is flooded with flags to disable CBOR but none of them worked for me.

您必须做两件事:

  1. 设置环境变量 AWS_CBOR_DISABLE = true 告诉 localstack 停止使用
  2. 设置环境变量 aws.cborEnabled = false 告诉 AWS SDK 停止使用它.
  1. Set environment var AWS_CBOR_DISABLE=true to tell localstack to stop using
  2. Set environment var aws.cborEnabled=false to tell AWS SDK to stop using it.

就我而言,我陷入了 software.amazon.awssdk.core.SdkSystemSetting

这篇关于从Java使用LocalStack时获取AmazonKinesisException状态代码:502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆