Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4ABEB200BB6 for ; Fri, 4 Nov 2016 08:33:43 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 49597160AE9; Fri, 4 Nov 2016 07:33:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E5EAA160AE8 for ; Fri, 4 Nov 2016 08:33:41 +0100 (CET) Received: (qmail 7014 invoked by uid 500); 4 Nov 2016 07:33:40 -0000 Mailing-List: contact user-help@jclouds.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@jclouds.apache.org Delivered-To: mailing list user@jclouds.apache.org Received: (qmail 7005 invoked by uid 99); 4 Nov 2016 07:33:40 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2016 07:33:40 +0000 Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 293811A0046 for ; Fri, 4 Nov 2016 07:33:40 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id t79so31881972wmt.0 for ; Fri, 04 Nov 2016 00:33:40 -0700 (PDT) X-Gm-Message-State: ABUngvck41kyV96VRCu+xSP0OV4bSbuGrv2OIjDMTxOLtOTmyYWKhIBDYXnHLglC+ynG+hjV00ATituHVBxpag== X-Received: by 10.194.153.228 with SMTP id vj4mr10686977wjb.204.1478244818797; Fri, 04 Nov 2016 00:33:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.139.201 with HTTP; Fri, 4 Nov 2016 00:33:18 -0700 (PDT) In-Reply-To: References: From: Ignasi Barrera Date: Fri, 4 Nov 2016 08:33:18 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Jclouds example for AWS cn-north-1 region To: "user@jclouds.apache.org" Content-Type: multipart/alternative; boundary=089e011777a950d5ea054074b15d archived-at: Fri, 04 Nov 2016 07:33:43 -0000 --089e011777a950d5ea054074b15d Content-Type: text/plain; charset=UTF-8 Can you try setting the endpoint too when creating the context? Properties overrides = new Properties(); overrides.put("jclouds.regions", "cn-north-1"); overrides.put("jclouds.region.cn-north-1.iso3166-codes", "CN-11"); Iterable modules = ImmutableSet. of(new SshjSshClientModule()); ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2") * .endpoint("https://ec2.cn-north-1.amazonaws.com ")* .credentials("user", "pass") .modules(modules) .overrides(overrides) .buildView(ComputeServiceContext.class); On 3 November 2016 at 23:23, Ruben Rubio Rey wrote: > > And see if you can connect there? In the account I have I don't see that > regions so I can't really test it. > > You need a registered Chinese company to activate that region. Actually, > they don't "activate" the region, they give you a brand new account only > with the Beijing zone. > > Unfortunately those properties are not working > > Properties overrides = new Properties(); > overrides.put("jclouds.regions", "cn-north-1"); > overrides.put("jclouds.region.cn-north-1.iso3166-codes", "CN-11"); > > Iterable modules = ImmutableSet. of(new > SshjSshClientModule()); > ComputeServiceContext context = ContextBuilder.newBuilder(" > aws-ec2") > .credentials("user", "pass") > .modules(modules) > .overrides(overrides) > .buildView(ComputeServiceContext.class); > ComputeService compute = context.getComputeService(); > Set nodes = compute.listNodes(); > System.out.print("Number of nodes " + nodes.size()); > > // log > org.jclouds.rest.AuthorizationException: POST https://ec2.us-east-1. > amazonaws.com/ HTTP/1.1 -> HTTP/1.1 401 Unauthorized > at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent. > refineException(ParseAWSErrorFromXmlContent.java:122) > at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError( > ParseAWSErrorFromXmlContent.java:89) > at org.jclouds.http.handlers.DelegatingErrorHandler.handleError( > DelegatingErrorHandler.java:65) > at org.jclouds.http.internal.BaseHttpCommandExecutorService > .shouldContinue(BaseHttpCommandExecutorService.java:136) > at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke( > BaseHttpCommandExecutorService.java:105) > 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.$Proxy74.describeRegions(Unknown Source) > at org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get( > DescribeRegionsForRegionURIs.java:50) > at org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get( > DescribeRegionsForRegionURIs.java:38) > at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier$SetAndThrowAuthorizationExcept > ionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.java:73) > at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier$SetAndThrowAuthorizationExcept > ionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.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.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.java:119) > at org.jclouds.location.suppliers.derived. > RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeyS > et.java:45) > at org.jclouds.location.suppliers.derived. > RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeyS > et.java:33) > at com.google.common.base.Suppliers$SupplierComposition. > get(Suppliers.java:67) > at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier$SetAndThrowAuthorizationExcept > ionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.java:73) > at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier$SetAndThrowAuthorizationExcept > ionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.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.MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOn > AuthorizationExceptionSupplier.java:119) > at org.jclouds.aws.ec2.compute.strategy.AWSEC2ListNodesStrategy. > pollRunningInstances(AWSEC2ListNodesStrategy.java:65) > at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy. > listDetailsOnNodesMatching(EC2ListNodesStrategy.java:107) > at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy.listNodes( > EC2ListNodesStrategy.java:86) > at org.jclouds.ec2.compute.strategy.EC2ListNodesStrategy.listNodes( > EC2ListNodesStrategy.java:58) > at org.jclouds.compute.internal.BaseComputeService.listNodes( > BaseComputeService.java:335) > at com.rubenrr.mvc.AwsTests.testChina(AwsTests.java:92) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:57) > at sun.reflect.DelegatingMethodAccessorImpl.invoke( > DelegatingMethodAccessorImpl.java:43) > at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( > FrameworkMethod.java:47) > at org.junit.internal.runners.model.ReflectiveCallable.run( > ReflectiveCallable.java:12) > at org.junit.runners.model.FrameworkMethod.invokeExplosively( > FrameworkMethod.java:44) > at org.junit.internal.runners.statements.InvokeMethod. > evaluate(InvokeMethod.java:17) > at org.junit.internal.runners.statements.RunBefores. > evaluate(RunBefores.java:26) > at org.springframework.test.context.junit4.statements. > RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks. > java:72) > at org.springframework.test.context.junit4.statements. > RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81) > at org.springframework.test.context.junit4.statements. > SpringRepeat.evaluate(SpringRepeat.java:72) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) > at org.springframework.test.context.junit4.SpringJUnit4ClassRunner. > runChild(SpringJUnit4ClassRunner.java:216) > at org.springframework.test.context.junit4.SpringJUnit4ClassRunner. > runChild(SpringJUnit4ClassRunner.java:82) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) > at org.springframework.test.context.junit4.statements. > RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:60) > at org.springframework.test.context.junit4.statements. > RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:67) > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > at org.springframework.test.context.junit4. > SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162) > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs( > JUnit4IdeaTestRunner.java:74) > at com.intellij.rt.execution.junit.JUnitStarter. > prepareStreamsAndStart(JUnitStarter.java:211) > at com.intellij.rt.execution.junit.JUnitStarter.main( > JUnitStarter.java:67) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke( > NativeMethodAccessorImpl.java:57) > at com.intellij.rt.execution.application.AppMain.main( > AppMain.java:134) > Caused by: org.jclouds.http.HttpResponseException: request: POST > https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 [Action=DescribeRegions] > failed with response: HTTP/1.1 401 Unauthorized > at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError( > ParseAWSErrorFromXmlContent.java:63) > ... 73 more > > On Thu, Nov 3, 2016 at 1:04 AM, Ignasi Barrera > wrote: > >> Hi Ruben, >> >> Can you try setting the following properties when creating the context: >> >> Properties overrides = new Properties(); >> overrides.put("jclouds.regions", "cn-north-1"); >> overrides.put("jclouds.region.cn-north-1.iso3166-codes", "CN-11"); >> >> Iterable modules = ImmutableSet. of(new >> SshjSshClientModule()); >> ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2") >> .credentials("user", "key") >> .modules(modules) >> .overrides(overrides) >> .buildView(ComputeServiceContext.class); >> >> >> And see if you can connect there? In the account I have I don't see >> that regions so I can't really test it. >> >> HTH! >> >> I. >> >> >> On 1 November 2016 at 07:39, Ruben Rubio Rey wrote: >> > Hi, >> > >> > I am trying to use AWS China region (cn-north-1) with JClouds. This >> region >> > works independently and you need to define the region (or the end >> point). >> > >> > I log in to other AWS regions >> > >> > Iterable modules = ImmutableSet. of(new >> > SshjSshClientModule()); >> > ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2") >> > .credentials("user", "key") >> > .modules(modules) >> > .buildView(ComputeServiceContext.class); >> > >> > ComputeService compute = context.getComputeService(); >> > Set nodes = compute.listNodes(); >> > >> > How can I define the region or the end point ? >> > >> > Regards, >> > Ruben >> > >> > >> > > --089e011777a950d5ea054074b15d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Can you try setting the endpoint too when creating the con= text?

Properties overrides =3D new Properties();
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 overrides.put("jclouds.regions", "cn-north-1&q= uot;);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 overrides.put("jclouds.region.cn= -north-1.iso3166-codes", "CN-11");

=C2=A0 =C2=A0 =C2= =A0 =C2=A0 Iterable<Module> modules =3D ImmutableSet.<Module> o= f(new SshjSshClientModule());
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ComputeService= Context context =3D ContextBuilder.newBuilder("aws-ec2")
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .endpoint("https://ec2.cn-north-1.amazon= aws.com")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 .credentials("user", "pass")
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .modules(modules)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .overrides(overrides)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .buildView(ComputeServ= iceContext.class);



On 3 November 2016 at 23:23, Ruben Rub= io Rey <tk421.1@gmail.com> wrote:
> And see if yo= u can connect there? In the account I have I don't see that regions so = I can't really test it.

You need a registered Chine= se company to activate that region. Actually, they don't "activate= " the region, they give you a brand new account only with the Beijing = zone.

Unfortunately those properties are not working

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Properties overr= ides =3D new Properties();
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ov= errides.put("jclouds.regions", "cn-north-1");
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 overrides.put("jclouds.regi= on.cn-north-1.iso3166-codes", "CN-11");

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Iterable<Module> modules =3D Imm= utableSet.<Module> of(new SshjSshClientModule());
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 ComputeServiceContext context =3D ContextBuilde= r.newBuilder("aws-ec2")
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .credent= ials("user", "pass")
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .modules(modul= es)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 .overrides(overrides)
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 .buildView(ComputeServiceContext.class);
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 ComputeService compute =3D context.getComputeSe= rvice();
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Set<? extends Com= puteMetadata> nodes =3D compute.listNodes();
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 System.out.print("Number of nodes " += nodes.size());

// log
org.jclouds.rest.AuthorizationE= xception: POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 -> HTTP/1.= 1 401 Unauthorized
=C2=A0=C2=A0=C2=A0 at org.jclouds.aws.handlers.P= arseAWSErrorFromXmlContent.refineException(ParseAWSErrorFromXmlCo= ntent.java:122)
=C2=A0=C2=A0=C2=A0 at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlCont= ent.java:89)
=C2=A0=C2=A0=C2=A0 at org.jclouds.http.handlers.D= elegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
=C2=A0=C2=A0=C2=A0 at org.jclouds.http.internal.BaseHttpComma= ndExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:136)
=C2=A0=C2=A0=C2=A0 at org.jclouds.http.internal.BaseH= ttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.internal.Invok= eHttpMethod.invoke(InvokeHttpMethod.java:90)
=C2=A0=C2=A0=C2=A0 at = org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod= .java:73)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.internal.InvokeHtt= pMethod.apply(InvokeHttpMethod.java:44)
=C2=A0=C2=A0=C2=A0 at org.j= clouds.reflect.FunctionalReflection$FunctionalInvocationHandler.<= wbr>handleInvocation(FunctionalReflection.java:117)
=C2=A0=C2=A0=C2= =A0 at com.google.common.reflect.AbstractInvocationHandler.invoke= (AbstractInvocationHandler.java:87)
=C2=A0=C2=A0=C2=A0 at com.= sun.proxy.$Proxy74.describeRegions(Unknown Source)
=C2=A0=C2=A0=C2= =A0 at org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get= (DescribeRegionsForRegionURIs.java:50)
=C2=A0=C2=A0=C2=A0 at o= rg.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get(De= scribeRegionsForRegionURIs.java:38)
=C2=A0=C2=A0=C2=A0 at org.jclou= ds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExce= ptionSupplier$SetAndThrowAuthorizationExceptionSupplierBacke= dLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationException= Supplier.java:73)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.suppliers.= MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier= $SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(= MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java= :57)
=C2=A0=C2=A0=C2=A0 at com.google.common.cache.LocalCache$= LoadingValueReference.loadFuture(LocalCache.java:3524)
=C2=A0= =C2=A0=C2=A0 at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
=C2=A0=C2=A0=C2=A0 at com.google.common.cache.<= wbr>LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
= =C2=A0=C2=A0=C2=A0 at com.google.common.cache.LocalCache$Segment.get(<= wbr>LocalCache.java:2195)
=C2=A0=C2=A0=C2=A0 at com.google.common.cache.= LocalCache.get(LocalCache.java:3934)
=C2=A0=C2=A0=C2=A0 at com= .google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)=C2=A0=C2=A0=C2=A0 at com.google.common.cache.LocalCache$LocalLoadin= gCache.get(LocalCache.java:4821)
=C2=A0=C2=A0=C2=A0 at org.jclouds.= rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExcepti= onSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationEx= ceptionSupplier.java:119)
=C2=A0=C2=A0=C2=A0 at org.jclouds.locatio= n.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:45)
=C2=A0=C2=A0=C2=A0 at o= rg.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIK= eySet.get(RegionIdsFromRegionIdToURIKeySet.java:33)
=C2= =A0=C2=A0=C2=A0 at com.google.common.base.Suppliers$SupplierCompositio= n.get(Suppliers.java:67)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.sup= pliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSuppli= er$SetAndThrowAuthorizationExceptionSupplierBackedLoader.loa= d(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:73)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.suppliers.Memoiz= edRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAn= dThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRet= ryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
=C2= =A0=C2=A0=C2=A0 at com.google.common.cache.LocalCache$LoadingValu= eReference.loadFuture(LocalCache.java:3524)
=C2=A0=C2=A0=C2=A0= at com.google.common.cache.LocalCache$Segment.loadSync(LocalCach= e.java:2317)
=C2=A0=C2=A0=C2=A0 at com.google.common.cache.LocalCac= he$Segment.lockedGetOrLoad(LocalCache.java:2280)
=C2=A0=C2=A0= =C2=A0 at com.google.common.cache.LocalCache$Segment.get(LocalCac= he.java:2195)
=C2=A0=C2=A0=C2=A0 at com.google.common.cache.LocalCa= che.get(LocalCache.java:3934)
=C2=A0=C2=A0=C2=A0 at com.google.comm= on.cache.LocalCache.getOrLoad(LocalCache.java:3938)
=C2=A0=C2= =A0=C2=A0 at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
=C2=A0=C2=A0=C2=A0 at org.jclouds.rest.suppli= ers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<= wbr>.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupp= lier.java:119)
=C2=A0=C2=A0=C2=A0 at org.jclouds.aws.ec2.compute.strategy.AWSEC2ListNodesStrategy.pollRunningInstances(AWS= EC2ListNodesStrategy.java:65)
=C2=A0=C2=A0=C2=A0 at org.jclouds.ec2= .compute.strategy.EC2ListNodesStrategy.listDetailsOnNodesMatching= (EC2ListNodesStrategy.java:107)
=C2=A0=C2=A0=C2=A0 at org.jclouds.e= c2.compute.strategy.EC2ListNodesStrategy.listNodes(EC2ListNo= desStrategy.java:86)
=C2=A0=C2=A0=C2=A0 at org.jclouds.ec2.compute.= strategy.EC2ListNodesStrategy.listNodes(EC2ListNodesStrategy.java= :58)
=C2=A0=C2=A0=C2=A0 at org.jclouds.compute.internal.BaseCompute= Service.listNodes(BaseComputeService.java:335)
=C2=A0=C2=A0=C2=A0 a= t com.rubenrr.mvc.AwsTests.testChina(AwsTests.java:92)
=C2=A0=C2=A0= =C2=A0 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Met= hod)
=C2=A0=C2=A0=C2=A0 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
=C2=A0=C2=A0=C2=A0 = at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegatin= gMethodAccessorImpl.java:43)
=C2=A0=C2=A0=C2=A0 at org.junit.runner= s.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.= java:47)
=C2=A0=C2=A0=C2=A0 at org.junit.internal.runners.model.Ref= lectiveCallable.run(ReflectiveCallable.java:12)
=C2=A0=C2=A0=C2=A0 = at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
=C2=A0=C2=A0=C2=A0 at org.junit.internal.runne= rs.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
=C2= =A0=C2=A0=C2=A0 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
=C2=A0=C2=A0=C2=A0 at org.springframewor= k.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:72)
=C2=A0=C2=A0= =C2=A0 at org.springframework.test.context.junit4.statements.RunA= fterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:81)
=C2=A0=C2=A0=C2=A0 at org.springframework.test.context.ju= nit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
= =C2=A0=C2=A0=C2=A0 at org.junit.runners.ParentRunner.runLeaf(Pare= ntRunner.java:271)
=C2=A0=C2=A0=C2=A0 at org.springframework.test.c= ontext.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4C= lassRunner.java:216)
=C2=A0=C2=A0=C2=A0 at org.springframework.test= .context.junit4.SpringJUnit4ClassRunner.runChild(Spring= JUnit4ClassRunner.java:82)
=C2=A0=C2=A0=C2=A0 at org.junit.runners.= ParentRunner$3.run(ParentRunner.java:238)
=C2=A0=C2=A0=C2=A0 a= t org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)=
=C2=A0=C2=A0=C2=A0 at org.junit.runners.ParentRunner.runChildren(<= wbr>ParentRunner.java:236)
=C2=A0=C2=A0=C2=A0 at org.junit.runners.= ParentRunner.access$000(ParentRunner.java:53)
=C2=A0=C2=A0=C2=A0 at= org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)=
=C2=A0=C2=A0=C2=A0 at org.springframework.test.context.junit4.stat= ements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestCla= ssCallbacks.java:60)
=C2=A0=C2=A0=C2=A0 at org.springframework.test= .context.junit4.statements.RunAfterTestClassCallbacks.evalua= te(RunAfterTestClassCallbacks.java:67)
=C2=A0=C2=A0=C2=A0 at o= rg.junit.runners.ParentRunner.run(ParentRunner.java:309)
=C2= =A0=C2=A0=C2=A0 at org.springframework.test.context.junit4.Spring= JUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:162)
=C2=A0= =C2=A0=C2=A0 at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
= =C2=A0=C2=A0=C2=A0 at com.intellij.junit4.JUnit4IdeaTestRunner.st= artRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
=C2=A0=C2=A0=C2=A0 = at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAnd= Start(JUnitStarter.java:211)
=C2=A0=C2=A0=C2=A0 at com.intellij.rt.= execution.junit.JUnitStarter.main(JUnitStarter.java:67)
=C2=A0= =C2=A0=C2=A0 at sun.reflect.NativeMethodAccessorImpl.invoke0(Nati= ve Method)
=C2=A0=C2=A0=C2=A0 at sun.reflect.NativeMethodAccessorIm= pl.invoke(NativeMethodAccessorImpl.java:57)
=C2=A0=C2=A0= =C2=A0 at com.intellij.rt.execution.application.AppMain.main(AppM= ain.java:134)
Caused by: org.jclouds.http.HttpResponseException: re= quest: POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1=C2=A0 [Action=3D= DescribeRegions] failed with response: HTTP/1.1 401 Unauthorized
=C2=A0= =C2=A0=C2=A0 at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.<= wbr>handleError(ParseAWSErrorFromXmlContent.java:63)
=C2=A0=C2= =A0=C2=A0 ... 73 more

On Thu, Nov 3, 2016 a= t 1:04 AM, Ignasi Barrera <ignasi.barrera@gmail.com> = wrote:
Hi Ruben,

Can you try setting the following properties when creating the context:

Properties overrides =3D new Properties();
overrides.put("jclouds.regions", "cn-north-1"); overrides.put("jclouds.region.cn-north-1.iso3166-codes", &qu= ot;CN-11");

Iterable<Module> modules =3D ImmutableSet.<Module> of(new SshjS= shClientModule());
ComputeServiceContext context =3D ContextBuilder.newBuilder("aws-= ec2")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .credentials("user", "key")=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .modules(modules)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .overrides(overrides)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .buildView(ComputeServiceContext.class);

And see if you can connect there? In the account I have I don't see
that regions so I can't really test it.

HTH!

I.


On 1 November 2016 at 07:39, Ruben Rubio Rey <tk421.1@gmail.com> wrote:
> Hi,
>
> I am trying to use AWS China region (cn-north-1) with JClouds. This re= gion
> works independently and you need to define the region (or the end poin= t).
>
> I log in to other AWS regions
>
> Iterable<Module> modules =3D ImmutableSet.<Module> of(new<= br> > SshjSshClientModule());
> ComputeServiceContext context =3D ContextBuilder.newBuilder("aws<= wbr>-ec2")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.credentials("user", "= key")
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.modules(modules)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.buildView(ComputeServiceContext= .class);
>
> ComputeService compute =3D context.getComputeService();
> Set<? extends ComputeMetadata> nodes =3D compute.listNodes(); >
> How can I define the region or the end point ?
>
> Regards,
> Ruben
>
>


--089e011777a950d5ea054074b15d--