当前位置:网站首页>com. fasterxml. jackson. databind. exc.MismatchedInputException: Expected array or string. at [Source:x
com. fasterxml. jackson. databind. exc.MismatchedInputException: Expected array or string. at [Source:x
2022-06-27 00:07:00 【Tag heartbeat】
Wrong scenario :
rabbitmq The consumer receives messages , Prompt cannot be serialized . According to the following error reports , yes java.time.LocalDateTime The reason for the type . ObjectMapper Not right LocalDateTime serialize
Problem description
rabbitmq The consumer receives messages , error message :
com.fasterxml.jackson.databind.exc.MismatchedInputException: Expected array or string.
at [Source: (String)"xx This is reception json object xx"[truncated 357 chars]; line: 1, column: 606] (through reference chain: com.csair.tang.logs.receiver.LogFlightcenterMessage["operationTime"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1468)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1242)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1170)
at com.fasterxml.jackson.datatype.jsr310.deser.JSR310DeserializerBase._handleUnexpectedToken(JSR310DeserializerBase.java:148)
at com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer.deserialize(LocalDateTimeDeserializer.java:159)
at com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer.deserialize(LocalDateTimeDeserializer.java:39)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:371)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:164)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4526)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3468)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3436)
at com.csair.tang.logs.receiver.LogFlightcenterReceiver.onTestMessage(LogFlightcenterReceiver.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120)
at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:53)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:239)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandlerAndProcessResult(MessagingMessageListenerAdapter.java:191)
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:137)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1630)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1549)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1537)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1528)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1472)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:977)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:923)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:83)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1298)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1204)
at java.lang.Thread.run(Thread.java:748)
2022-06-23 23:34:13.056 ERROR[org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#0-1]com.csair.tang.logs.receiver.LogFlightcenterReceiver.onTestMessage:53 - Log receiving exception :Expected array or string.
Solution
Add the following comments to the producer message template properties :
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)

Restart consumer services , Resend message test
边栏推荐
- go中的微服务和容器编排
- Is the low commission free account opening channel safe?
- 大咖讲 | 最前沿的昇思MindSpore开源社区运营的经验分享,快拿出小本本记录呀!
- The user adds a timer function in the handler () goroutine. If it times out, it will be kicked out
- golang语言的开发学习路线
- An article takes you to learn container escape
- Where is it safer to open an account to buy funds
- [micro service]nacos
- 【Try to Hack】正向shell和反向shell
- xshell的安装、xftp的安装
猜你喜欢

Implement the queue through two stacks

Super hard core! Can the family photo album on Huawei's smart screen be classified automatically and accurately?

Thesis study -- Analysis of the influence of rainfall field division method on rainfall control rate

Unity4.6 Download

大咖讲 | 最前沿的昇思MindSpore开源社区运营的经验分享,快拿出小本本记录呀!

PHP代码审计系列(一) 基础:方法、思路、流程

Solid and ambient colors

Pinpoint attackers with burp

go语言的爬虫和中间件
![[microservice]eureka](/img/60/e5fa18d004190d4dadebfb16b93550.png)
[microservice]eureka
随机推荐
Can I open an account for stock trading on my mobile phone? Is it safe to open an account for stock trading on the Internet
[微服务]Eureka
买基金在哪里开户买比较安全
[microservices] understanding microservices
万字详解-MindArmour 小白教程!
软件工程导论——第四章——形式化说明技术
Openpyxl module
Technical dry goods | top speed, top intelligence and minimalist mindspore Lite: help Huawei watch become more intelligent
[test] the content of the hottest test development learning route has been updated again to help pass the customs and open the test of large factories
手机上炒股开户可靠吗 网上开户炒股安全吗
简单测试轻量级表达式计算器Flee
互联网行业,常见含金量高的证书,看看你有几个?
技术干货|什么是大模型?超大模型?Foundation Model?
新型冠状病毒变异Delta毒株的模拟(MindSPONGE应用)
论文学习——降雨场次划分方法对降雨控制率的影响分析
Your connection is not private
客户端实现client.go客户端类型定义连接
Safe and cost-effective payment in Thailand
手机能开户炒股吗 网上开户炒股安全吗
Understanding of "the eigenvectors corresponding to different eigenvalues cannot be orthogonalized"