Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] 关于类型转换问题 #4801

Open
1 task done
9997766 opened this issue Mar 24, 2024 · 5 comments
Open
1 task done

[Question] 关于类型转换问题 #4801

9997766 opened this issue Mar 24, 2024 · 5 comments
Labels
need research This bug haven't been reproduced yet or this feature is under POC question Further information is requested

Comments

@9997766
Copy link

9997766 commented Mar 24, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Question

我用docker运行eventmesh 服务端,用rocketmq作为存储,用sdk中的http作为subsciber消费消息时,eventmesh.out的日志报如下错误,我猜测是因为不同的类加载器,导致的EventMeshConsumeConcurrentlyContext 和ConsumeConcurrentlyContext 不认,应该把plugin下的rocket-storage的包,拷贝到apps下能解决问题,
是否能重新打镜像包,放到库上?

tenerConcurrently.java:63) - handleMessage fail
java.lang.ClassCastException: org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext cannot be cast to org.apache.eventmesh.storage.rocketmq.patch.EventMeshConsumeConcurrentlyContext
at org.apache.eventmesh.storage.rocketmq.patch.EventMeshMessageListenerConcurrently.consumeMessage(EventMeshMessageListenerConcurrently.java:44) [eventmesh-storage-rocketmq-1.10.0-release.jar:1.10.0-release]
at org.apache.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService$ConsumeRequest.run(ConsumeMessageConcurrentlyService.java:402) [rocketmq-client-4.9.5.jar:4.9.5]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_181]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181] 如何处理

@9997766 9997766 added the question Further information is requested label Mar 24, 2024
Copy link
Contributor

Welcome to the Apache EventMesh community!!
We are glad that you are contributing by opening this issue. :D

Please make sure to include all the relevant context.
We will be here shortly.

If you are interested in contributing to our project, please let us know!
You can check out our contributing guide on contributing to EventMesh.

Want to get closer to the community?

WeChat Assistant WeChat Public Account Slack
Join Slack Chat

Mailing Lists:

Name Description Subscribe Unsubscribe Archive
Users User support and questions mailing list Subscribe Unsubscribe Mail Archives
Development Development related discussions Subscribe Unsubscribe Mail Archives
Commits All commits to repositories Subscribe Unsubscribe Mail Archives
Issues Issues or PRs comments and reviews Subscribe Unsubscribe Mail Archives

@xwm1992
Copy link
Contributor

xwm1992 commented Mar 24, 2024

Okay, we will test this issue again and will provide feedback later.

@qqeasonchen
Copy link
Contributor

@9997766 It would be better to write in English so many others can read.

@Pil0tXia
Copy link
Member

Pil0tXia commented Apr 10, 2024

@9997766

应该把plugin下的rocket-storage的包,拷贝到apps下能解决问题

I think this is not a good way to solve this issue, since the jar files under /apps are all APIs like eventmesh-storage-api-1.10.0-release.jar and shouldn't have a specific implementation.

Will you reproduce this issue with source code? It seems the exception was throwed at org.apache.eventmesh.storage.rocketmq.patch.EventMeshMessageListenerConcurrently Line 44.

@Pil0tXia Pil0tXia changed the title 关于类型转换问题 [Question] 关于类型转换问题 Apr 12, 2024
@yinglalanice
Copy link

yinglalanice commented May 8, 2024

@Pil0tXia
这个问题我也遇到了,使用源码启动的方式没有问题,但是不管是使用二进制还是Docker的启动方式都有问题。

分析了一下原因可能是org.apache.rocketmq.client.impl.consumer.ConsumeMessageConcurrentlyService 这个类在两个包中都存在:eventmesh-storage-rocketmq-1.10.0-release.jarrocketmq-client-4.9.5.jar。在本地源码启动时可能类加载的是eventmesh-storage-rocketmq-1.10.0-release.jar所以没有问题,二进制部署时类加载rocketmq-client-4.9.5.jar,导致创建的类型就是ConsumeConcurrentlyContext而不是EventMeshConsumeConcurrentlyContext。

解决方案就是自定义一个类加载器,先吧eventmesh-storage-rocketmq-1.10.0-release.jar包中的ConsumeMessageConcurrentlyService加载进来,但是还没有想好这个类加载器放在哪更优雅一些

@Pil0tXia Pil0tXia added the need research This bug haven't been reproduced yet or this feature is under POC label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need research This bug haven't been reproduced yet or this feature is under POC question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants