You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Xwiam (via GitHub)" <gi...@apache.org> on 2024/07/29 09:32:27 UTC

[I] [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null [dubbo]

Xwiam opened a new issue, #14477:
URL: https://github.com/apache/dubbo/issues/14477

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   3.2.0
   
   ### Steps to reproduce this issue
   
   1、consumer lazy init config
   dubbo:consumer init=false
   2、start your dubbo service
   3、use arthas to invoke your dubbo service
   you will get the NPE Exception
   <img width="948" alt="image" src="https://github.com/user-attachments/assets/1956e6fd-ef01-4d68-9c68-ae1d7350bbaf">
   
   
   ### What you expected to happen
   
   the invoke will be ok,not throw NPE Exception 
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: notifications-unsubscribe@dubbo.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null [dubbo]

Posted by "Xwiam (via GitHub)" <gi...@apache.org>.
Xwiam commented on issue #14477:
URL: https://github.com/apache/dubbo/issues/14477#issuecomment-2255475614

   https://github.com/apache/dubbo/pull/14478#issue-2434947239


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ closed issue #14477: [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null
URL: https://github.com/apache/dubbo/issues/14477


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null [dubbo]

Posted by "Xwiam (via GitHub)" <gi...@apache.org>.
Xwiam commented on issue #14477:
URL: https://github.com/apache/dubbo/issues/14477#issuecomment-2255473811

   https://github.com/apache/dubbo/pull/14457#issue-2421864066


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] NPE will occur when consumer lazy init and the consumer thread contextClassLoader is null [dubbo]

Posted by "Xwiam (via GitHub)" <gi...@apache.org>.
Xwiam commented on issue #14477:
URL: https://github.com/apache/dubbo/issues/14477#issuecomment-2257867462

   when mH2i.getSerializerFactory().getClassLoader() is null , the NPE exception will occur
   
   public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
           if (!mH2i.getSerializerFactory().getClassLoader().equals(Thread.currentThread().getContextClassLoader())) {
               mH2i.setSerializerFactory(hessian2FactoryManager.getSerializerFactory(Thread.currentThread().getContextClassLoader()));
           }
           return readObject(cls);
       }


-- 
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: notifications-unsubscribe@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org