There is a servlet running on tomcat7 and it makes a webservice call to a third party website. The call works fine from the windows machine but when run from tomcat it fails. Wont Tomcat automatically use the Windows' proxy settings? I added
set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxySet=true"
set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxyHost=IP"
set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxyPort=8080"
to CATALINA.BAT and
http.proxyHost=IP
http.proxyPort=8080
to catalina.properties But still there is no change. How do we set Tomcat to use the proxy settings of windows and is there a way to check if tomcat is picking up the proxy settings specified?
Apache httpd Proxy SupportThis can be used to forward requests for a particular web application to a Tomcat instance, without having to configure a web connector such as mod_jk . To accomplish this, you need to perform the following tasks: Configure your copy of Apache so that it includes the mod_proxy module.
Tomcat contexts can be configured to expect proxied requests using a connector element with the appropriate proxy-specific attributes configured: <Connector port="8082"... The values of these attributes should match the values you have configured within your proxy server.
I do not agree with the usage of java.net.Proxy
.
What happens if you need to change it ? New build, new release. The setting of the proxy should be easy. It works well with both system properties or tomcat JAVA_OPTS. I used it in both ways. Just pay attention and be sure you know what JAVA_OPTS are loaded, what java is used and so on, because there are tomcats that have their own java version. Regardint the previous post, there is no way java can be used before was loaded :). So Tomcat cannot use it before the system properties are used...only if tomcat uses another JRE that does not read system properties.
I just test this setup :
set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=proxy.com -Dhttp.proxyPort=8080 "
in catalina.bat and works well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With