No response to regular proxy configuration mechanisms of Java

Hi,

  • running snap behind a corporate firewall requiring to use proxies seems to have problems when accessing the product library (error message and stack trace below)
  • investigation showed that the proxy config seems not to be properly used
  • we did a quick hard coded fix in the constructor of org.esa.snap.productlibrary.opensearch.OpenSearch and added a setProxy call to AbderaClient (ie.) client.setProxy(proxyurl,proxyport);. That fixed the issue in our environment immediately. A proper solution should take the proxy parameters from the snap config

Stack trace:
FINE [org.apache.commons.httpclient.HttpConnection]: Open connection to scihub.copernicus.eu:443
FINEST [org.apache.commons.httpclient.HttpConnection]: enter HttpConnection.closeSockedAndStreams()
FINE [org.apache.commons.httpclient.HttpMethodDirector]: Closing the connection.
FINEST [org.apache.commons.httpclient.HttpConnection]: enter HttpConnection.close()
FINEST [org.apache.commons.httpclient.HttpConnection]: enter HttpConnection.closeSockedAndStreams()
INFO [org.apache.commons.httpclient.HttpMethodDirector]: I/O exception (java.net.SocketException) caught when processing request: Malformed reply from SOCKS server
FINE [org.apache.commons.httpclient.HttpMethodDirector]: Malformed reply from SOCKS server
java.net.SocketException: Malformed reply from SOCKS server
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.(Unknown Source)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
at org.apache.abdera.protocol.client.util.SimpleSSLProtocolSocketFactory.createSocket(SimpleSSLProtocolSocketFactory.java:64)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
[catch] at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:688)
at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:216)
at org.apache.abdera.protocol.client.AbderaClient.get(AbderaClient.java:404)
at org.esa.snap.productlibrary.opensearch.OpenSearch.connect(OpenSearch.java:142)

1 Like

@re30067 could you elaborate more on how to implement this to make SNAP work behind a corporate proxy? Not used to work with Java

Thanks @re30067 for the problem report and for the hint how it can be fixed.
Sorry, for not answering earlier.
Meanwhile the code is different, and the product library does not use the OpenSearch class anymore.
But it is still used in the S1TBX to download GNSS orbit files.

@lveci can you check if the suggestion needs to be considered.

@oana_hogoiu can you have a look at it and check if the new product library works correctly.

@sentinel Have you experienced issues? What kind of problem? The problem can perhaps be solved in another way than by changing the code.

@marpet my issue is with the proxy settings. Currently working on a Windows machine behind a company proxy. In SNAP GUI, in the WWW tab, I have tried with all options (no proxy, system proxy, and manual setting) and still SNAP (gpt, snappy or the GUI) cannot handle it and gives me time out errors when using operators that require the download of files (update orbits, terrain correction, etc.)

Moreover, this is also blocking the possibility to update SNAP. I am currently working on SNAP 8.0.0 and S1TBX, S2TBX and S3TBX are also on 8.0.0. I am aware some bugs have been solved in 8.0.4 which is the one in which I would like to work.

I have been digging on this forum to find related posts and this is the selection I found which contains relevant infro from my point of view. Some areq quite old and maybe not applicable anymore:

-Dhttp.proxyHost=http.proxy.ip
-Dhttp.proxyPort=NNNN
-Dhttps.proxyHost=https.proxy.ip
-Dhttps.proxyPort=MMMM

About not being able to update SNAP, it seems updated versions can be download manually and then installed. See here:

Also, a not so related solution that I found - [SNAP-561] Error "Address family not supported by protocol family: connect" when updating modules - JIRA

So my question is, which one of the approaches is still valid? Should I first manually update SNAP to 8.0.4 and then deal with the proxy settings? The other way around? Any experience on this?

As I have no environment behind a proxy I can’t really give a suggestion.
But, as far as I remember none of the updates since 8.0.0 is changing the proxy handling.

So, you could try to solve the issue first and then do the update.
I would try the following:
setting the Property: -J-Djava.net.preferIPv4Stack=true
This can also be set to the gpt.vmoptions file as
-Djava.net.preferIPv4Stack=true
and to the snap.conf file (without ‘-D’) in the etc folder.

If this does not help, then try the settings given at the oracle page:
Java Networking and Proxies (oracle.com)

Maybe someone else has more experience with proxies than me?

Thanks for the information. I have tried the suggested solution. This is how my gpt.vmoptions file looks like now:

And this is how my snap.conf file looks like:

Once saved, I go to SNAP GUI, and try to update the software. I am still getting the proxy error. In the WWW tab, in the proxy settings, I have the manuel proxy settings with my proxi info.

Am I missing something?