We are using weblogic server for our project. I have created a ProxySelector class and made it the default in my code. When my code tried to access the external url, the ProxySelector is called for socket url but not http url. Because of this, I am not able to return any HTTP proxy object from the ProxySelector and it fails.
Note: The code works fine if I execute it from tomcat.
I cannot try system properties or jvm startup parameters. I needed a per connection approach. I am using webservices which does not do any url connection opening. Instead it uses a dispatch object to access a service. So the only thing I have is ProxySelector.
Also My application is vast and it tries to access external urls at lots of places, we want to use this as this is a centralized approach.
I am checking for HTTP protocol before returning the HTTP Proxy. In case of other protocol ftp or socket, I just pass the call to JVM provided default selector.
When I execute this code on tomcat, it works fine. Here the proxyselector is invoked with the same http url and so I am able to return proxy object.
When I execute this code on weblogic, the ProxySelector is not invoked with http url but invoked with the same url but the "socket" protocol or scheme.
For eg, if I access http://www.yahoo.com, the weblogic invokes the ProxySelector with socket://www.yahoo.com
I asked someone from the web services team to take a look, but they are very busy and I'm not sure how much time they have to investigate this. I recommend opening a support case to get someone that can be dedicated to researching this issue.
The second code I have presented is http case which also fails with weblogic. Its not specific to webservice and so other team may be able to look at this.
1. You can enclose the http url invocation code in normal java main method and check it will invoke the ProxySelector with http url.
2. You can put the http url invocation code in some servlet and run it on tomcat, it will invoke the ProxySelector with http url.
3. But when you put the same code on session bean running on weblogic, the ProxySelector is invoked with socket url. No invocation is done for http url.
As I responded before, if you have not had another response here, then it's unlikely that the WLS team responsible for this feature will be able to investigate this outside of support channels and therefore you should open a service request with support.oracle.com to get someone with a dedicated SLA to track this down.
As a shot in the dark, on an internal mailing list someone recommended this option for someone having an issue with getting the java.net.Authenticator to work as expected due to WLS using it's own URL stream handler. I'm not sure if the same machinery is used for ProxySelectors or not, but if you could try adding -DUseSunHttpHandler=true to Weblogic Startup.