You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by David Bosschaert <da...@gmail.com> on 2015/02/07 22:09:54 UTC

[jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Hi all,

I'm getting an exception with jclouds 1.8.1 in the template builder on
locationId where I pass in the location as EU_WEST_1.

TemplateBuilder templateBuilder = compute.templateBuilder();
        templateBuilder
                .hardwareId(InstanceType.C3_XLARGE)
                .imageId(IMAGE_ID)
                .locationId(Region.EU_WEST_1)
                .options(opts);

This gives me the exception below. The weird thing is that the
stacktrace contains:
  Caused by: java.net.UnknownHostException: ec2.ap-northeast-1.amazonaws.com
where I specifically put in EU_WEST_1.

Does anyone know what might be causing this?

Thanks,

David

-  Cannot retry after server error, command has exceeded retry limit
5: [method=org.jclouds.ec2.features.AvailabilityZoneAndRegionApi.public
abstract java.util.Set
org.jclouds.ec2.features.AvailabilityZoneAndRegionApi.describeAvailabilityZonesInRegion(java.lang.String,org.jclouds.ec2.options.DescribeAvailabilityZonesOptions[])[ap-northeast-1,
[Lorg.jclouds.ec2.options.DescribeAvailabilityZonesOptions;@46b1aaef],
request=POST https://ec2.ap-northeast-1.amazonaws.com/ HTTP/1.1]
org.jclouds.http.HttpResponseException:
ec2.ap-northeast-1.amazonaws.com connecting to POST
https://ec2.ap-northeast-1.amazonaws.com/ HTTP/1.1
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:110)
at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44)
at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87)
at com.sun.proxy.$Proxy68.describeAvailabilityZonesInRegion(Unknown Source)
at org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion.get(DescribeAvailabilityZonesInRegion.java:64)
at org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion.get(DescribeAvailabilityZonesInRegion.java:43)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:73)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:119)
at org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues.get(ZoneIdsFromRegionIdToZoneIdsValues.java:50)
at org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues.get(ZoneIdsFromRegionIdToZoneIdsValues.java:37)
at com.google.common.base.Suppliers$SupplierComposition.get(Suppliers.java:67)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:73)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:119)
at org.jclouds.location.suppliers.all.ZoneToRegionToProviderOrJustProvider.get(ZoneToRegionToProviderOrJustProvider.java:72)
at org.jclouds.location.suppliers.all.ZoneToRegionToProviderOrJustProvider.get(ZoneToRegionToProviderOrJustProvider.java:46)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:73)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:119)
at org.jclouds.compute.domain.internal.TemplateBuilderImpl.locationId(TemplateBuilderImpl.java:618)
...
Caused by: java.net.UnknownHostException: ec2.ap-northeast-1.amazonaws.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:649)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1146)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:997)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1281)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1256)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.writePayloadToConnection(JavaUrlHttpCommandExecutorService.java:303)
at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:190)
at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:71)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:88)
... 53 more

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by David Bosschaert <da...@gmail.com>.
Thanks Ignasi! That property override seems to do the trick!

Cheers,

David

On 9 February 2015 at 09:07, Ignasi Barrera <na...@apache.org> wrote:
> Hi!
>
> This is a known issue. See JCLOUDS-540 [1].
>
> In your case, you should be able to limit the regions jclouds is
> connecting by setting the "jclouds.regions" property when creating the
> context. Something like the following should work:
>
> Properties overrides = new Properties();
> overrides.setProperty(LocationConstants.PROPERTY_REGIONS, Region.EU_WEST_1);
>
> ComputeServiceContext ctx = ContextBuilder.newBuilder("aws.ec2")
>           .overrides(overrides)
>           (...)
>           .buildView(ComputeServiceContext.class);
>
>
> HTH!
>
> I.
>
>
> [1] https://issues.apache.org/jira/browse/JCLOUDS-540
>
> On 8 February 2015 at 21:24, David Bosschaert
> <da...@gmail.com> wrote:
>> Thanks Giovanni. At least moving my DNS setting to an alternative one
>> gets around the problem. I'm still wondering whether it's a good idea
>> that jclouds contacts all the regions (and the whole thing fails when
>> one of the machines in a region that I don't care about isn't
>> accessible). Maybe I should look at the code in more detail and
>> provide a patch ;)
>>
>> Cheers,
>>
>> David
>>
>> On 8 February 2015 at 14:44, Giovanni Toraldo <me...@gionn.net> wrote:
>>> On Sun, Feb 8, 2015 at 12:22 PM, David Bosschaert
>>> <da...@gmail.com> wrote:
>>>> It happens irregularly (but quite often) the thing I don't understand is why
>>>> it even tries to connect to a host in the Asia - pacific region when I
>>>> explicitly say 'eu-west-1'?
>>>
>>> As far as I can understand, jclouds needs to fill-up some structures
>>> with fresh information from EC2 API before doing anything (and after
>>> the cache TTL expire), iterating over every available region, even if
>>> you are actually using one particular region at a time.
>>>
>>> Maybe your ISP DNS servers are a little flaky or overloaded; can you
>>> try to use on your machine OpenDNS (208.67.220.220, 208.67.222.222) or
>>> Google DNS (8.8.8.8, 8.8.4.4)? It may helps.
>>>
>>> Cheers,
>>>
>>> --
>>> Giovanni Toraldo
>>> http://gionn.net

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by Ignasi Barrera <na...@apache.org>.
Hi!

This is a known issue. See JCLOUDS-540 [1].

In your case, you should be able to limit the regions jclouds is
connecting by setting the "jclouds.regions" property when creating the
context. Something like the following should work:

Properties overrides = new Properties();
overrides.setProperty(LocationConstants.PROPERTY_REGIONS, Region.EU_WEST_1);

ComputeServiceContext ctx = ContextBuilder.newBuilder("aws.ec2")
          .overrides(overrides)
          (...)
          .buildView(ComputeServiceContext.class);


HTH!

I.


[1] https://issues.apache.org/jira/browse/JCLOUDS-540

On 8 February 2015 at 21:24, David Bosschaert
<da...@gmail.com> wrote:
> Thanks Giovanni. At least moving my DNS setting to an alternative one
> gets around the problem. I'm still wondering whether it's a good idea
> that jclouds contacts all the regions (and the whole thing fails when
> one of the machines in a region that I don't care about isn't
> accessible). Maybe I should look at the code in more detail and
> provide a patch ;)
>
> Cheers,
>
> David
>
> On 8 February 2015 at 14:44, Giovanni Toraldo <me...@gionn.net> wrote:
>> On Sun, Feb 8, 2015 at 12:22 PM, David Bosschaert
>> <da...@gmail.com> wrote:
>>> It happens irregularly (but quite often) the thing I don't understand is why
>>> it even tries to connect to a host in the Asia - pacific region when I
>>> explicitly say 'eu-west-1'?
>>
>> As far as I can understand, jclouds needs to fill-up some structures
>> with fresh information from EC2 API before doing anything (and after
>> the cache TTL expire), iterating over every available region, even if
>> you are actually using one particular region at a time.
>>
>> Maybe your ISP DNS servers are a little flaky or overloaded; can you
>> try to use on your machine OpenDNS (208.67.220.220, 208.67.222.222) or
>> Google DNS (8.8.8.8, 8.8.4.4)? It may helps.
>>
>> Cheers,
>>
>> --
>> Giovanni Toraldo
>> http://gionn.net

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by David Bosschaert <da...@gmail.com>.
Thanks Giovanni. At least moving my DNS setting to an alternative one
gets around the problem. I'm still wondering whether it's a good idea
that jclouds contacts all the regions (and the whole thing fails when
one of the machines in a region that I don't care about isn't
accessible). Maybe I should look at the code in more detail and
provide a patch ;)

Cheers,

David

On 8 February 2015 at 14:44, Giovanni Toraldo <me...@gionn.net> wrote:
> On Sun, Feb 8, 2015 at 12:22 PM, David Bosschaert
> <da...@gmail.com> wrote:
>> It happens irregularly (but quite often) the thing I don't understand is why
>> it even tries to connect to a host in the Asia - pacific region when I
>> explicitly say 'eu-west-1'?
>
> As far as I can understand, jclouds needs to fill-up some structures
> with fresh information from EC2 API before doing anything (and after
> the cache TTL expire), iterating over every available region, even if
> you are actually using one particular region at a time.
>
> Maybe your ISP DNS servers are a little flaky or overloaded; can you
> try to use on your machine OpenDNS (208.67.220.220, 208.67.222.222) or
> Google DNS (8.8.8.8, 8.8.4.4)? It may helps.
>
> Cheers,
>
> --
> Giovanni Toraldo
> http://gionn.net

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by Giovanni Toraldo <me...@gionn.net>.
On Sun, Feb 8, 2015 at 12:22 PM, David Bosschaert
<da...@gmail.com> wrote:
> It happens irregularly (but quite often) the thing I don't understand is why
> it even tries to connect to a host in the Asia - pacific region when I
> explicitly say 'eu-west-1'?

As far as I can understand, jclouds needs to fill-up some structures
with fresh information from EC2 API before doing anything (and after
the cache TTL expire), iterating over every available region, even if
you are actually using one particular region at a time.

Maybe your ISP DNS servers are a little flaky or overloaded; can you
try to use on your machine OpenDNS (208.67.220.220, 208.67.222.222) or
Google DNS (8.8.8.8, 8.8.4.4)? It may helps.

Cheers,

-- 
Giovanni Toraldo
http://gionn.net

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by David Bosschaert <da...@gmail.com>.
Hi Giovanni,

It happens irregularly (but quite often) the thing I don't understand is
why it even tries to connect to a host in the Asia - pacific region when I
explicitly say 'eu-west-1'?

Cheers,

David

On Sunday, 8 February 2015, Giovanni Toraldo <me...@gionn.net> wrote:
> Hi David,
>
> this looks like a DNS glitch with your internet connection (Caused by:
> java.net.UnknownHostException: ec2.ap-northeast-1.amazonaws.com), have
> you retried?
>
> --
> Giovanni Toraldo
> http://gionn.net
>

Re: [jclouds 1.8.1] Exception on templateBuilder (AWS EC2), connecting to the wrong region?

Posted by Giovanni Toraldo <me...@gionn.net>.
Hi David,

this looks like a DNS glitch with your internet connection (Caused by:
java.net.UnknownHostException: ec2.ap-northeast-1.amazonaws.com), have
you retried?

-- 
Giovanni Toraldo
http://gionn.net