question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can the starter provide support for deserializing generic parameters?

See original GitHub issue

When I created the following code, there was an exception: `@Slf4j @Service @RocketMQMessageListener(consumerGroup = “abc” ,topic = TopicConstant.test_topic) public class TestConsumer implements RocketMQListener<TestEvent<String>> {

@Override
public void onMessage(TestEvent<String> s) {
    log.info("consumer message:{}", s);
}

}`

Exception------- Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.getMessageType(DefaultRocketMQListenerContainer.java:381) at org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer.afterPropertiesSet(DefaultRocketMQListenerContainer.java:277) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ... 19 common frames omitted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zhoulinshuncommented, Apr 18, 2019

hmm, interesting, it is deserves to investigate and improve. 前一段时间在项目中遇到了这个问题, 不过通过改写org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer 已经暂时解决了这个问题,期待你们的下一次更新。

0reactions
walking98commented, Apr 19, 2019

嗯,有空可以把你解决的细节给大家共享一下。也有助于我们提高这块代码 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deserialization Not Working Right with Generic Types and ...
When trying to deserialize a generic type using a builder it is deserializing the generic type as a LinkedHashMap instead of the proper...
Read more >
java - Jackson - Deserialize using generic class - Stack Overflow
I need to specify what type T is at runtime. The parameter clazz is what T us at runtime. So, how to call...
Read more >
Spring Boot: Customize the Jackson ObjectMapper - Baeldung
Learn how to configure the serialization and deserialization options for Jackson using Spring Boot.
Read more >
Android Data Serialization Tutorial with the Kotlin Serialization ...
It's generic type parameter specifies the type of object serialized by the serializer. Open BoredActivity.kt in data. Below BoredActivity , add ...
Read more >
Spring Data Commons - Reference Documentation
To create a query method that supports dynamic sorting, see “Special parameter handling”. 4.4.3. Property Expressions. Property expressions can ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found