jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruben Rubio Rey <tk42...@gmail.com>
Subject Re: Jclouds example for AWS cn-north-1 region
Date Thu, 03 Nov 2016 22:23:01 GMT
> 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<Module> modules = ImmutableSet.<Module> of(new
SshjSshClientModule());
        ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2")
                .credentials("user", "pass")
                .modules(modules)
                .overrides(overrides)
                .buildView(ComputeServiceContext.class);
        ComputeService compute = context.getComputeService();
        Set<? extends ComputeMetadata> 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.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.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:45)
    at
org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:33)
    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.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 <ignasi.barrera@gmail.com>
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<Module> modules = ImmutableSet.<Module> 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 <tk421.1@gmail.com> 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<Module> modules = ImmutableSet.<Module> of(new
> > SshjSshClientModule());
> > ComputeServiceContext context = ContextBuilder.newBuilder("aws-ec2")
> >         .credentials("user", "key")
> >         .modules(modules)
> >         .buildView(ComputeServiceContext.class);
> >
> > ComputeService compute = context.getComputeService();
> > Set<? extends ComputeMetadata> nodes = compute.listNodes();
> >
> > How can I define the region or the end point ?
> >
> > Regards,
> > Ruben
> >
> >
>

Mime
View raw message