当前位置: 首页 > 知识库问答 >
问题:

Kafka Connect REST接口“PUT/connectors/(string:name)/config”返回错误代码500

张星洲
2023-03-14

我有一个分布式模式下的 3 节点 kafka-connect 工作线程集群,带有正在运行的 s3 接收器连接器。为了在运行时更新连接器的配置,我运行以下命令:

curl -X PUT -H "Content-Type: application/json" --data @s3.json http://localhost:8083/connectors/<connector-name>/config

然而,它返回:

{"error_code":500,"message":"Cannot deserialize instance of `java.lang.String` out of START_OBJECT token\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 14] (through reference chain: java.util.LinkedHashMap[\"config\"])"}

工人的完整日志在这里:

 [2018-11-19 15:10:47,471] ERROR Uncaught exception in REST call to /connectors/s3-sink-common-log/config (org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper:61)
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 14] (through reference chain: java.util.LinkedHashMap["config"])
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
    at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:63)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:10)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
    at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574)
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965)
    at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:815)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:257)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:236)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)
    at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundReadFrom(MappableExceptionWrapperInterceptor.java:73)
    at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:156)
    at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1091)
    at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:874)
    at org.glassfish.jersey.server.ContainerRequest.readEntity(ContainerRequest.java:271)
    at org.glassfish.jersey.server.internal.inject.EntityParamValueParamProvider$EntityValueSupplier.apply(EntityParamValueParamProvider.java:97)
    at org.glassfish.jersey.server.internal.inject.EntityParamValueParamProvider$EntityValueSupplier.apply(EntityParamValueParamProvider.java:80)
    at org.glassfish.jersey.server.spi.internal.ParamValueFactoryWithSource.apply(ParamValueFactoryWithSource.java:74)
    at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:92)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$AbstractMethodParamInvoker.getParamValues(JavaResourceMethodDispatcherProvider.java:133)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
    at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
    at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:169)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:531)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:132)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
    at java.lang.Thread.run(Thread.java:748)
[2018-11-19 15:10:47,476] INFO 127.0.0.1 - - [19/Nov/2018:23:10:47 +0000] "PUT /connectors/s3-sink-common-log/config HTTP/1.1" 500 294  38 (org.apache.kafka.connect.runtime.rest.RestServer:60)

对于背景:工作线程集群位于 Ubuntu 16.04 上,包 confluent-kafka-connect-s3=5.0.0-1 和 confluent-kafka-2.11=2.0.0-1。apache-kafka 的版本是 2.0.0-cp1。s3.json 文件的内容是正确的,因为我可以删除当前连接器并使用新的 json 文件重新创建它。

共有1个答案

赵夕
2023-03-14

解决了。对于< code > PUT/connectors/(string:name)/config API,s3.json的内容是错误的。如果< code>POST /connectors API的json文件的格式如下:

{
  "name": "<connector-name>",
  "config": { 
     "<blabla...>",
  }
}

那么正确的json文件的格式是:

{ 
   "name": "<connector-name>",
   "<blabla...>"
}
 类似资料:
  • 在我的MySQL数据库中,我有一个表"table1",在列"name"上设置了唯一约束-我想防止重复的名称。 如果表中已经有名字'John',则此代码: 应该抛出insertUnonnequeException()(我自己的异常)。相反,它抛出InsertException()。 查询的执行返回false,执行进入if()循环。另外$db- 我不知道为什么当发生唯一密钥约束冲突时,mysqli不返

  • 我试图开发一个android应用程序使用华为网站套件。我现在正在跟踪这个codelab:https://developer.huawei.com/consumer/en/codelab/hmssitekit/index.html#0我完全按照codelab说的做了一切,但是当我运行我的应用程序时,它抛出了一个错误,在日志中它说“错误代码6” 以前有人收到过同样的错误并解决了吗?请帮帮我

  • 我在MVC应用程序中使用Ajax来在您单击注销按钮时发送回一个帖子。我想将用户送回登录页面,并将他们路由到控制器中的HttpPost方法。但是,在我的Ajax代码中,当我单击注销时会出现一个错误:找不到网址:http://localhost/myapp/error/error?code=22 PageHeader.cshtml AccountController.cs

  • 在我的laravel项目上运行composer install时,我得到错误: 脚本php artisan clear已编译,用于处理返回的安装后cmd事件,错误代码为255 对可能出现的问题有什么建议吗?注意:composer安装所有供应商软件包。完整输出如下: [user@some_path]$composer update 加载具有包信息的composer存储库 更新依赖项(包括需要开发)

  • 我在Spring boot中编写了一个简单的REST,用rest assured编写的一个测试用例返回http代码400,而它在curl中运行良好。 服务: 测试类: 测试跑步者: 测试输出: 以下行显示返回400: DEBUG 组织 apache.http.impl.conn.DefaultClientConnection - 正在接收响应: HTTP/1.1 400 下面是一个很好的curl请

  • 我有一个请求和响应Json。当我提交请求时,它将在我的应用程序中显示响应。Url显示邮递员请求和响应[1]:https://i.stack.imgur.com/UW4jo.png我尝试了下面的代码,但面临的问题是,我得到了正确的JSONObject响应,但在调试时,当光标进入改装的onResponse方法时,主体显示为null,错误代码为500。但在《邮差》中,一切都很好。我因为这个问题浪费了两天