RE: Apparently-random UnknownHostException while attempting POST operation

2013-09-25 Thread Robert Dodier
Problem solved, I hope -- apparently IPv6 causes trouble for the Java VM -- 
this is a bug in Java, but a workaround is to put 
-Djava.net.preferIPv4Stack=true on the Java command line. It seems to have made 
the UnknownHostException go away, so I am happy!

Others have bumped into this bug; see:
http://stackoverflow.com/questions/1608503/domain-name-resolution-not-working-in-java-applications-on-ubuntu64-9-04-machine

and also:
http://www-01.ibm.com/support/docview.wss?uid=nas8N1011363

Hope this helps,

Robert Dodier

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3065253


Re: Apparently-random UnknownHostException while attempting POST operation

2013-09-25 Thread Jerome Louvel
Thanks Robert for sharing your solution to this issue!

Best regards,
Jerome


2013/9/25 Robert Dodier robert.dod...@gmail.com

 Problem solved, I hope -- apparently IPv6 causes trouble for the Java VM
 -- this is a bug in Java, but a workaround is to put
 -Djava.net.preferIPv4Stack=true on the Java command line. It seems to have
 made the UnknownHostException go away, so I am happy!

 Others have bumped into this bug; see:

 http://stackoverflow.com/questions/1608503/domain-name-resolution-not-working-in-java-applications-on-ubuntu64-9-04-machine

 and also:
 http://www-01.ibm.com/support/docview.wss?uid=nas8N1011363

 Hope this helps,

 Robert Dodier

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3065253


--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3065260

Apparently-random UnknownHostException while attempting POST operation

2013-09-24 Thread Robert Dodier
Hi, I am working with Restlet 2.1.2 on Linux (RHEL 6 on x86_64). java
-version reports:

java version 1.6.0_24
OpenJDK Runtime Environment (IcedTea6 1.11.3) (rhel-1.48.1.11.3.el6_2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

I have a thread which executes a POST every few seconds. Every now and
then (happens irregularly, perhaps varying from a few minutes to an
hour) I get UnknownHostException for a while (varies, perhaps about a
minute) and then POST succeeds for some time after that. The
UnknownHostException is puzzling because the host name is always the
same, and if I try resolving the name another way (namely, using the
host program on the command line) then the host name is resolved.

I've appended a typical stack trace below. Thanks in advance for any
light you can shed on this question.

best

Robert Dodier

PS.
An error occurred during the communication with the remote HTTP server.

java.net.UnknownHostException: innovmdmtest.cloudapp.net
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
at java.net.InetAddress.getAllByName(InetAddress.java:1128)
at java.net.InetAddress.getAllByName(InetAddress.java:1064)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at 
org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at 
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
at 
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at 
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at 
org.restlet.ext.httpclient.internal.HttpMethodCall.sendRequest(HttpMethodCall.java:336)
at org.restlet.engine.adapter.ClientAdapter.commit(ClientAdapter.java:114)
at 
org.restlet.engine.adapter.HttpClientHelper.handle(HttpClientHelper.java:112)
at org.restlet.Client.handle(Client.java:180)
at org.restlet.routing.Filter.doHandle(Filter.java:159)
at org.restlet.routing.Filter.handle(Filter.java:206)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1136)
at 
org.restlet.resource.ClientResource.handleOutbound(ClientResource.java:1225)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1025)
at org.restlet.resource.ClientResource.post(ClientResource.java:1418)
at foo.bar.RelayToRestServer.postToRestServer(RelayToRestServer.java:183)
at foo.bar.RelayToRestServer.relay(RelayToRestServer.java:114)
at foo.bar.RelayToRestServer.recalculate(RelayToRestServer.java:101)
at foo.bar.MyTimerTask.run(MyTimerTask.java:126)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Communication Error (1001) - The connector failed to complete the
communication with the server
at org.restlet.resource.ClientResource.doError(ClientResource.java:612)
at 
org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1202)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1026)
at org.restlet.resource.ClientResource.post(ClientResource.java:1418)
at foo.bar.RelayToRestServer.postToRestServer(RelayToRestServer.java:183)
at foo.bar.RelayToRestServer.relay(RelayToRestServer.java:114)
at foo.bar.RelayToRestServer.recalculate(RelayToRestServer.java:101)
at foo.bar.MyTimerTask.run(MyTimerTask.java:126)
at java.util.TimerThread.mainLoop(Timer.java:534)
at java.util.TimerThread.run(Timer.java:484)
Caused by: java.net.UnknownHostException: innovmdmtest.cloudapp.net
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
at java.net.InetAddress.getAllByName(InetAddress.java:1128)
at java.net.InetAddress.getAllByName(InetAddress.java:1064)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
at 
org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
at 
org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)