tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Gollery <>
Subject servlet accessing remote server through SOCKS
Date Fri, 25 Oct 2002 21:54:21 GMT
Some of you may think this question has been asked and answered before. 
As far as I can determine, it has not. Here's the situation:

I'm using Tomcat 4.1.12 and Java

I have a servlet that needs to collect some information from another web 
site. The servlet fails to connect, even though I have set it up to go 
out through our firewall using a SOCKS proxy, like this:

       System.getProperties().setProperty("socksProxySet", "true");
       System.getProperties().setProperty("socksProxyHost", myProxyHost);
       System.getProperties().setProperty("socksProxyPort", myProxyPort);

The code in this part of the servlet works fine when I set it up so I 
can run it from the command line, but within Tomcat I get a "Network is 
unreachable" exception on the connect.

I have found several "answers" to this problem that say to set the 
TOMCAT_OPTS env variable to  -DsocksProxyHost=myProxyHost 

But even after changing "TOMCAT_OPTS" to "CATALINA_OPTS" for Tomcat 4, 
this approach still doesn't work because -- if I understand what's 
happening -- it sets up Tomcat to listen through the SOCKS proxy. Since 
I don't have permission to run a program that does this, Tomcat crashes 
on startup, without going anywhere near my servlet. Using the 
CATALINA_OPTS approach would allow other programs to communicate with 
Tomcat from outside the firewall, but I want a servlet that communicates 
from inside the firewall to a server that exists outside the firewall.

If this is not possible for some reason, I'd be interested in finding 
out what the reason is. I'd also be interested in alternative approaches.

Steven Gollery

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message