Hi,
Context:
According to
http://stackoverflow.com/questions/9811828/common-httpclient-and-proxy it seems
that some versions of HttpClient need a separate configuration / code to set an
http proxy, while others use the JVM http.proxyHost and http.proxyPort as their
default. Is my understanding correct?
We configure Tomcat6 with JAVA_OPTS="-Dhttp.proxySet=true -Dhttp.proxyHost=<IP
of proxy> -Dhttp.proxyPort=<Port of proxy (8080)> -Dhttp.nonProxyHosts=<hosts
that should not be accessed through the proxy> $JAVA_OPTS"
Problem:
We use a third party software which, in an attempt of an HTTP POST with basic
auth (which should use an http proxy server configured above) gives a stack
trace ending in:
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:249)
at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at
org.topbraidlive.server.workspace.DeployUtil.isFormAuthetication(DeployUtil.java:68)
at
org.topbraidlive.server.workspace.DeployUtil.authenticate(DeployUtil.java:46)
at
org.topbraidlive.sparqlmotion.modules.PostRequestModule.perhapsAuthenticate(PostRequestModule.java:165)
... 55 more
My assumption so far is that the HttpClient in use needs a separate http proxy
configuration (and does not take it from the JVM parameters intended for this
purpose).
An explanation of this is that it uses a standalone / embedded http stack, and
only reuses the core tcp stack from the JVM. Is that the case?
I am in the process of finding out the exact name and version of the apache
artifact which contains the HttpClient class seen in the stack trace.
Please advise,
Nicu Marasoiu
Enterprise Java Architect
[cid:[email protected]]
+ 40 724 746 655
+ 40 372 707 667
+ 40 372 254 685
Mobile
Logistics & Administration
Fax Machine
www.computas.ro<http://www.computas.ro/>
11 Cretei Street, sector 1, Bucharest, 014154
Computas IT Romania SRL is a subsidiary of Computas Holding AS, Oslo, Norway
The content of this message and attachments are confidential and are classified
as Computas IT Romania SRL's Proprietary Information. The content of this
message is intended solely for the use of the individual or entity to whom it
is addressed and others authorized to receive it. If you are not the intended
recipient you are hereby notified that any disclosure, copying, distribution or
taking any action based on this information are strictly prohibited and may be
precluded by law. If you have received this message in error, please notify us
immediately and then delete it from your system. Computas IT Romania SRL is
neither liable for the proper and complete transmission of the information
contained in this message nor for any delay in its receipt. This email and
attachments (if any) has been scanned for viruses using ESET NOD32 Antivirus
before dispatch. However, please note that neither Computas IT Romania SRL, nor
the sender accepts any responsibility for viruses and it is your responsibility
to scan the email and attachments. No contracts may be concluded on behalf of
Computas IT Romania SRL by means of email communications. Thank you.
[cid:[email protected]]Do you really need to print this?