B4J Question Using HttpUtils2 behind a proxy

jmon

Well-Known Member
Licensed User
Hi,

when using HttpUtils2 I get an error when calling PostString:
Error: job1 : java.net.UnknownHostException: www.xxxxxxx.netau.net

My website is not down, the files are there. I have managed to ping correctly from another computer. I have read on the forum that the reason of this error is that I have no internet connection. I guess in my case is because I am behind a proxy.

Is there a way to specify my proxy address with HttpUtils2?

Thanks for your help.
Jmon.
 

FabioRome

Member
Licensed User
hi Erel,
my code is:
B4X:
SetSystemProperty("http.proxyHost", ProxyHost)
SetSystemProperty("http.proxyPort", ProxyPort)
SetSystemProperty("http.proxyUser", ProxyUsername)
SetSystemProperty("http.proxyPassword", ProxyPassword)

but I receive them:

B4X:
Program started.
java.net.UnknownHostException: my_site_destination
   at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
   at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
   at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
   at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
   at java.net.InetAddress.getAllByName(InetAddress.java:1162)
   at java.net.InetAddress.getAllByName(InetAddress.java:1098)
   at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:126)
   at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
   at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
   at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
   at anywheresoftware.b4a.http.HttpClientWrapper.executeWithTimeout(HttpClientWrapper.java:310)
   at anywheresoftware.b4a.http.HttpClientWrapper.access$0(HttpClientWrapper.java:308)
   at anywheresoftware.b4a.http.HttpClientWrapper$ExecuteHelper.run(HttpClientWrapper.java:207)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)

can you help me? thanks
 
Upvote 0

giga

Well-Known Member
Licensed User
Are you referencing each of these as a string?

ProxyHost
ProxyPort
ProxyUsername
ProxyPassword

example
B4X:
SetSystemProperty("http.proxyhost", "proxy ip address")
SetSystemProperty("http.proxyport", "proxy port")
SetSystemProperty("http.proxyusername", "proxy username")
SetSystemProperty("http.proxypasswordt", "porxypassword")
 
Upvote 0

FabioRome

Member
Licensed User
B4X:
Program started.
java.net.UnknownHostException: my_site_destination
 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
 at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
 at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
 at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
 at java.net.InetAddress.getAllByName(InetAddress.java:1162)
 at java.net.InetAddress.getAllByName(InetAddress.java:1098)
 at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:126)
 at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
 at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
 at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
 at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
 at anywheresoftware.b4a.http.HttpClientWrapper.executeWithTimeout(HttpClientWrapper.java:310)
 at anywheresoftware.b4a.http.HttpClientWrapper.access$0(HttpClientWrapper.java:308)
 at anywheresoftware.b4a.http.HttpClientWrapper$ExecuteHelper.run(HttpClientWrapper.java:207)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
 
Upvote 0
Top