Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

ISSUE-11270: Use NarClassLoader in protocol hander callbacks. #2756

Closed
sijie opened this issue Jul 9, 2021 · 0 comments
Closed

ISSUE-11270: Use NarClassLoader in protocol hander callbacks. #2756

sijie opened this issue Jul 9, 2021 · 0 comments

Comments

@sijie
Copy link
Member

sijie commented Jul 9, 2021

Original Issue: apache#11270


Is your enhancement request related to a problem? Please describe.
I am working on a new protocol handler for an existing mq implementation.
ClassNotFoundException occurs when I am calling methods like com.fastjson.JSON.parseObject("some json str", MyConfig.class). This happens because the MyConfig.class is dynamically loaded by a NarClassLoader in protocol hander mechanism, but current thread calling ProtocolHandler::initialize uses the default class load in pulsar.

Describe the solution you'd like
IMHO, Maybe it's not very elegant for protocol handler to handle class loader issue in its own project?

As there is an ProtocolHandlerWithClassLoader object in each protocol handlers, I am suggesting change the thread default class loader to the NarClassLoader before we call interfaces in ProtocolHandler.

Describe alternatives you've considered
Currently, I am getting the NarClassLoader through MyProtocolHandler.class.getClassLoader().
I think it's a bit of tricky.

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant