You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/01/28 15:47:53 UTC

[GitHub] [rocketmq-spring] Jenyow opened a new issue #426: Could not deserialize localdatetime when using jdk8

Jenyow opened a new issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426


   **BUG REPORT**
   
   1. Please describe the issue you observed:
   Using RocketMQTemplate send object message with LocalDateTime. The @RocketMQMessageListener annotation consumer can't deserialize LocalDateTime.
   
   2. Please tell us about your environment:
   * spring-boot:2.3.12.RELEASE
   * rocketmq-spring-boot-starter:2.2.1
   
   3. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
   The latest version is not resolve the same ISSUE #239. 
   Please fix it and provide samples with the object message with LocalDateTime produce and consume.Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] RongtongJin closed issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] Jenyow edited a comment on issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
Jenyow edited a comment on issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426#issuecomment-1024352957


   The code use **new MappingJackson2MessageConverter()**, so it can't use my custom  MappingJackson2MessageConverter.
   ```
   package org.apache.rocketmq.spring.support;
   
   import java.util.ArrayList;
   import java.util.List;
   import org.springframework.messaging.converter.ByteArrayMessageConverter;
   import org.springframework.messaging.converter.CompositeMessageConverter;
   import org.springframework.messaging.converter.ContentTypeResolver;
   import org.springframework.messaging.converter.MappingJackson2MessageConverter;
   import org.springframework.messaging.converter.MessageConverter;
   import org.springframework.messaging.converter.StringMessageConverter;
   import org.springframework.util.ClassUtils;
   
   public class RocketMQMessageConverter {
       private static final boolean JACKSON_PRESENT;
       private static final boolean FASTJSON_PRESENT;
       private final CompositeMessageConverter messageConverter;
   
       public RocketMQMessageConverter() {
           List<MessageConverter> messageConverters = new ArrayList();
           ByteArrayMessageConverter byteArrayMessageConverter = new ByteArrayMessageConverter();
           byteArrayMessageConverter.setContentTypeResolver((ContentTypeResolver)null);
           messageConverters.add(byteArrayMessageConverter);
           messageConverters.add(new StringMessageConverter());
           if (JACKSON_PRESENT) {
               messageConverters.add(new MappingJackson2MessageConverter());
           }
   
           if (FASTJSON_PRESENT) {
               try {
                   messageConverters.add((MessageConverter)ClassUtils.forName("com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter", ClassUtils.getDefaultClassLoader()).newInstance());
               } catch (IllegalAccessException | InstantiationException | ClassNotFoundException var4) {
               }
           }
   
           this.messageConverter = new CompositeMessageConverter(messageConverters);
       }
   
       public MessageConverter getMessageConverter() {
           return this.messageConverter;
       }
   
       static {
           ClassLoader classLoader = RocketMQMessageConverter.class.getClassLoader();
           JACKSON_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader) && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader);
           FASTJSON_PRESENT = ClassUtils.isPresent("com.alibaba.fastjson.JSON", classLoader) && ClassUtils.isPresent("com.alibaba.fastjson.support.config.FastJsonConfig", classLoader);
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] Jenyow commented on issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
Jenyow commented on issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426#issuecomment-1043978935


   @RongtongJin What is your suggestion?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] Jenyow edited a comment on issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
Jenyow edited a comment on issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426#issuecomment-1043978935


   @RongtongJin What is your suggestion? Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] RongtongJin commented on issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
RongtongJin commented on issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426#issuecomment-1070553964


   Merged


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq-spring] Jenyow commented on issue #426: Could not deserialize localdatetime when using jdk8

Posted by GitBox <gi...@apache.org>.
Jenyow commented on issue #426:
URL: https://github.com/apache/rocketmq-spring/issues/426#issuecomment-1024352957


   The code can't use my custom  MappingJackson2MessageConverter.
   ![image](https://user-images.githubusercontent.com/7712958/151578593-fa44ae2f-94b7-4719-82ff-b201c96ebb12.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org