When java.net.useSystemProxies is set as follows:-
# Java Additional Parameters
wrapper.java.additional.1=-Djava.net.useSystemProxies=TRUE
and the application is run as a console from app.bat,
proxy settings are detected from internet explorer.
However, when the application is installed as a
service, the proxy settings are not detected (
INFO | jvm 1 | 2006/07/03 13:31:30 | proxy type :
DIRECT
INFO | jvm 1 | 2006/07/03 13:31:30 | No Proxy) -
Code for detecting proxies is as follows:-
public void detectProxy() {
try {
System.setProperty("java.net.useSystemProxies","true");
List l = ProxySelector.getDefault().select(
new URI("http://www.yahoo.com/"));
for (Iterator iter = l.iterator();
iter.hasNext(); ) {
Proxy proxy = (Proxy) iter.next();
System.out.println("proxy type : " +
proxy.type());
InetSocketAddress addr =
(InetSocketAddress)
proxy.address();
if(addr == null) {
System.out.println("No Proxy");
} else {
System.out.println("proxy port : "
+ addr.getPort());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Regards,
G
Logged In: YES
user_id=228081
This is most likely being caused because the service is
running as the SYSTEM user. It will have a different
environment and is thus not finding your explorer proxy
settings. Try setting the wrapper.ntservice.account.
Or setting your proxy using system wide environment
variables and then passing those to the JVM.
Cheers,
Leif