+Bhathiya

On Thu, Jun 9, 2016 at 4:45 PM, Harsha Kumara <[email protected]> wrote:

> Hi All,
>
> In the IS as KM setup, we are getting error mentioned in the $Subject.
> This is a intermittent behavior which occurs when generating a user token.
> As I went through the code, IS side, it's initialize the handlers
> configured in the identity.xml when the first token request has made to the
> server.
>
> It seems this behavior cause due to using
> the Thread.currentThread().getContextClassLoader(). If we
> use getClass().getClassLoader() this issue won't get when we requesting a
> token.
>
> As I read through some articles recommends
> Thread.currentThread().getContextClassLoader() and vice versa. As I read
> through getContextClassLoader loader uses the class loader of the current
> thread. If someone not explicitly set a class loader it will be pickup
> default class loader of parent thread which is system class loader while
> getClass().getClassLoader() will use the class loader of the current class.
>
> I'm not sure changing the class name is the best way to solve the issue
> but appears that it's fixed it. I have made a pull request changing the
> class loader in [3].
>
>
> [1] http://blog.osgi.org/2011/05/what-you-should-know-about-class.html
> [2]
> http://www.javaworld.com/article/2077344/core-java/find-a-way-out-of-the-classloader-maze.html
> [3] https://github.com/wso2-extensions/identity-inbound-auth-oauth/pull/78
> [4]
> http://stackoverflow.com/questions/1771679/difference-between-threads-context-class-loader-and-normal-classloader
>
> Thanks,
> Harsha
> --
> Harsha Kumara
> Software Engineer, WSO2 Inc.
> Mobile: +94775505618
> Blog:harshcreationz.blogspot.com
>



-- 
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: +94775505618
Blog:harshcreationz.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to