You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2010/12/15 20:03:57 UTC

Re: [OT] JVM http.proxyHost param is not activated

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Noriyo,

(Marking OT as this has nothing to do with Tomcat).

On 12/15/2010 1:17 PM, Noriyo Koyama wrote:
>  I'd like to have your advice on the recent strange behavior on the
> proxy JVM param.
> I use tomcat 6 with the JVM param such as below for enabling the proxy
> when the application access to the external network.
> -DproxySet=true -DproxyHost=proxy-out -DproxyPort=3128
> -Dhttp.nonProxyHosts="localhost|luceneserver.*|*.de.local"
> -Dhttp.proxyHost=proxy-out -Dhttp.proxyPort=3128

How are you launching Tomcat? How are you setting these JVM parameters?
Can you confirm that the JVM is reading them properly and using the
values you expect?

> Before it was working correct and recently we migrated the server and
> having the problem that the connection from the application is not
> using the proxy setting set at JVM param. (I don't have any
> authentication at the proxy.)

What code are you using to "access the external network"?

> Server version: Apache Tomcat/6.0.24

You should upgrade: Tomcat 6.0.29 is available.

> JVM Version:    1.6.0_17-b04

You should upgrade: 1.6.0_20-b02 is available.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0JER0ACgkQ9CaO5/Lv0PAWKQCeILR2hlLB9tkQPlprU+J80tEZ
+GsAnRYJC0a4SX2zMXapm2is5Q4izDuq
=LXbc
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] JVM http.proxyHost param is not activated

Posted by Noriyo Koyama <ca...@gmail.com>.
Thanks Chris,

Yes , I also googled and see some post like that describes to use the
proxy with programmatic code.
And with the test code such as below could work in my environment
without problem. But question is why it used to work without
programmatic code but with JVM param. This probably more relates to
the JVM spec. so I'll investigate bit further and share this if I find
something. Thanks a lot for the clues.

--snippet
	/*
	 * This is to use the proxy setting.
	 */
	private static final String proxyHost = System.getProperty("proxyHost");
	//proxy port number
	private static final String proxyPort = System.getProperty("proxyPort");
	private static int proxyPortNumber = -1;
	static{
		if(proxyHost!=null && proxyPort !=null){
			
			try{
				proxyPortNumber = Integer.valueOf(proxyPort);
				// Using proxy access
				LogService.logInfo(RSSParserImpl.class, "Using proxy |
proxyHost:"+proxyHost + "  proxyPort:"+proxyPort);
			}catch (NumberFormatException ex){
				LogService.logError(RSSParserImpl.class, "proxy port number should
be numeric: " , ex);
			}
		}
			
	}

--
//Using proxy access to retrieve the contents
if(proxyHost!=null && proxyPortNumber > -1){
	client.getHostConfiguration().setProxy(proxyHost,proxyPortNumber);
}
--

- Nori

On Thu, Dec 16, 2010 at 8:50 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Noriyo,
>
> On 12/15/2010 2:38 PM, Noriyo Koyama wrote:
>>> Can you confirm that the JVM is reading them properly and using the
>>> values you expect?
>>
>> System.getProperty("http.proxyHost"); could return the expected value.
>> So I think the JVM has its value set.
>
> Okay, does "proxy-out" resolve to anything on your server?
>
>>> What code are you using to "access the external network"?
>> Using HttpClient and there is no programatic logic to use the proxy.
>
> Google has a pretty good answer for "httpclient proxy":
>
> http://softwarecarnival.blogspot.com/2008/03/apache-http-client-and-proxy-settings.html
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk0KbZAACgkQ9CaO5/Lv0PA5MQCgk3g5OBkFxI4vph/DyL5pYWcT
> CQAAmwXV0Q5iBoV2QRYAsoD6ZaH88bR3
> =LDix
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] JVM http.proxyHost param is not activated

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Noriyo,

On 12/15/2010 2:38 PM, Noriyo Koyama wrote:
>> Can you confirm that the JVM is reading them properly and using the
>> values you expect?
>
> System.getProperty("http.proxyHost"); could return the expected value.
> So I think the JVM has its value set.

Okay, does "proxy-out" resolve to anything on your server?

>> What code are you using to "access the external network"?
> Using HttpClient and there is no programatic logic to use the proxy.

Google has a pretty good answer for "httpclient proxy":

http://softwarecarnival.blogspot.com/2008/03/apache-http-client-and-proxy-settings.html

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0KbZAACgkQ9CaO5/Lv0PA5MQCgk3g5OBkFxI4vph/DyL5pYWcT
CQAAmwXV0Q5iBoV2QRYAsoD6ZaH88bR3
=LDix
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] JVM http.proxyHost param is not activated

Posted by Noriyo Koyama <ca...@gmail.com>.
Hi, Chris,

 Thanks for the prompt reply.
You are right that this may not relate to Tomcat at all.

> How are you launching Tomcat? How are you setting these JVM parameters?
The below is how I start up the tomcat
/usr/bin/java -Djava.util.logging.config.file=/opt/xxx/conf/logging.properties
-server -XX:+UseConcMarkSweepGC -Ds=app20 -Djava.awt.headless=true
-Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Xms512m -Xmx1g
-XX:MaxPermSize=256m -DproxySet=true -DproxyHost=proxy-out
-DproxyPort=3128
-Dhttp.nonProxyHosts="localhost|luceneserver.*|*.de.local"
-Dhttp.proxyHost=proxy-out -Dhttp.proxyPort=3128
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/opt/xxx/endorsed -classpath
/opt/xxx/bin/bootstrap.jar -Dcatalina.base=/opt/xxx
-Dcatalina.home=/opt/xxx -Djava.io.tmpdir=/opt/xxx/temp
org.apache.catalina.startup.Bootstrap start

> Can you confirm that the JVM is reading them properly and using the
> values you expect?
System.getProperty("http.proxyHost"); could return the expected value.
So I think the JVM has its value set.

> What code are you using to "access the external network"?
Using HttpClient and there is no programatic logic to use the proxy.

Nori

On Wed, Dec 15, 2010 at 8:03 PM, Christopher Schultz
<ch...@christopherschultz.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Noriyo,
>
> (Marking OT as this has nothing to do with Tomcat).
>
> On 12/15/2010 1:17 PM, Noriyo Koyama wrote:
>>  I'd like to have your advice on the recent strange behavior on the
>> proxy JVM param.
>> I use tomcat 6 with the JVM param such as below for enabling the proxy
>> when the application access to the external network.
>> -DproxySet=true -DproxyHost=proxy-out -DproxyPort=3128
>> -Dhttp.nonProxyHosts="localhost|luceneserver.*|*.de.local"
>> -Dhttp.proxyHost=proxy-out -Dhttp.proxyPort=3128
>
> How are you launching Tomcat? How are you setting these JVM parameters?
> Can you confirm that the JVM is reading them properly and using the
> values you expect?
>
>> Before it was working correct and recently we migrated the server and
>> having the problem that the connection from the application is not
>> using the proxy setting set at JVM param. (I don't have any
>> authentication at the proxy.)
>
> What code are you using to "access the external network"?
>
>> Server version: Apache Tomcat/6.0.24
>
> You should upgrade: Tomcat 6.0.29 is available.
>
>> JVM Version:    1.6.0_17-b04
>
> You should upgrade: 1.6.0_20-b02 is available.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk0JER0ACgkQ9CaO5/Lv0PAWKQCeILR2hlLB9tkQPlprU+J80tEZ
> +GsAnRYJC0a4SX2zMXapm2is5Q4izDuq
> =LXbc
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org