How to check for an internal class in another module from java.base?

Wang Weijun weijun.wang at oracle.com
Tue Nov 1 15:18:45 UTC 2016


> On Nov 1, 2016, at 11:10 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> 
> 
> On 01/11/2016 15:02, Wang Weijun wrote:
>> HTTP Negotiate uses
>> 
>>   Class.forName("sun.net.www.protocol.http.spnego.NegotiatorImpl", true, null);
>> 
>> to check if the implementation in java.security.jgss module is provided. It looks like this call is throwing a ClassNotFoundException now. Shall I export the package to java.base or is there any other trick? I remember there used to be an addReads method but seems no one is using it now.
>> 
>> Or I must use a service loader?
>> 
> This is just visibility. The jdk.security.jgss module is defined to the platform class loader but but you have specified "null" (= bootstrap class loader) to Class.forName.

Wow. I changed it to ClassLoaders.platformClassLoader() and it runs.

> 
> There is an issue in JIRA to track change the HTTP protocol handler to use services for authentication mechanism, I don't think anyone has had time to work on that yet.

So before making this big change, do you think I can make the small change above to make them at least start working?

Thanks
Max

> 
> -Alan.



More information about the jigsaw-dev mailing list