You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Andrew Bayer <an...@gmail.com> on 2013/09/26 23:04:50 UTC
Strange error in AWS EC2 live tests
java.lang.IllegalArgumentException: backend type:
org.jclouds.rest.ApiContext<org.jclouds.ec2.EC2Api> not assignable from
org.jclouds.rest.ApiContext<org.jclouds.aws.ec2.AWSEC2Api>
at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
at org.jclouds.internal.BaseView.unwrap(BaseView.java:54)
at org.jclouds.internal.BaseView.unwrapApi(BaseView.java:77)
at
org.jclouds.aws.ec2.compute.AWSEC2ComputeServiceLiveTest.testExtendedOptionsAndLogin(AWSEC2ComputeServiceLiveTest.java:81)
And others with that same exception - any ideas?
A.
Re: Strange error in AWS EC2 live tests
Posted by Adrian Cole <ad...@gmail.com>.
Probably something is incorrectly using the provider key "ec2" in an
"aws-ec2" test.
On Sep 26, 2013 2:05 PM, "Andrew Bayer" <an...@gmail.com> wrote:
> java.lang.IllegalArgumentException: backend type:
> org.jclouds.rest.ApiContext<org.jclouds.ec2.EC2Api> not assignable from
> org.jclouds.rest.ApiContext<org.jclouds.aws.ec2.AWSEC2Api>
> at
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
> at org.jclouds.internal.BaseView.unwrap(BaseView.java:54)
> at org.jclouds.internal.BaseView.unwrapApi(BaseView.java:77)
> at
>
> org.jclouds.aws.ec2.compute.AWSEC2ComputeServiceLiveTest.testExtendedOptionsAndLogin(AWSEC2ComputeServiceLiveTest.java:81)
>
> And others with that same exception - any ideas?
>
> A.
>
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
Quoting Andrew Bayer <an...@gmail.com>:
> java.lang.IllegalArgumentException: backend type:
> org.jclouds.rest.ApiContext<org.jclouds.ec2.EC2Api> not assignable from
> org.jclouds.rest.ApiContext<org.jclouds.aws.ec2.AWSEC2Api>
> at
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:120)
> at org.jclouds.internal.BaseView.unwrap(BaseView.java:54)
> at org.jclouds.internal.BaseView.unwrapApi(BaseView.java:77)
> at
> org.jclouds.aws.ec2.compute.AWSEC2ComputeServiceLiveTest.testExtendedOptionsAndLogin(AWSEC2ComputeServiceLiveTest.java:81)
>
> And others with that same exception - any ideas?
Well, the error itself seems correct since, from what I recall about
generics [1],
A.isAssignableFrom(B)
does not imply
ApiContext<A>.isAssignableFrom(ApiContext<B>)
(although ApiContext<? extends A>.isAssignableFrom(ApiContext<B>)
should work).
So I'm not sure if the checkArgument [2] is actually correct. If it
is, then our API contexts are not correctly set up.
ap
[1] http://docs.oracle.com/javase/tutorial/java/generics/inheritance.html
[2]
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/internal/BaseView.java#L54
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
> No, it isn't - there's no getApi() on the return from unwrap().
Ah, yes...there's indeed a cast of context to ApiContext missing in my
example, which probably should have been something like:
(AWSEC2Api) ((ApiContext) unwrap()).getApi()
But I see you worked around it in a different way, anyway ;-)
ap
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
> Nope, that's not the case. Looking at
> https://github.com/jclouds/jclouds/blob/master/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java#L43,
> it's got the right provider, but it's barfing. I was able to get the test
> to pass by changing "AWSEC2Api client = view.unwrapApi(AWSEC2Api.class)" to
> "AWSEC2Api client = (AWSEC2Api)view.unwrapApi(EC2Api.class)" but that feels
> like cheating, and makes me worry about actual use cases...
Erm...please ignore my question about the backend type - the error
message tells us that. Looks like there's a bug in the ApiContext for
AWS EC2: the backend type should surely be
org.jclouds.rest.ApiContext<org.jclouds.ec2.AWSEC2Api>
and not
org.jclouds.rest.ApiContext<org.jclouds.ec2.EC2Api>
..?
ap
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
> it's got the right provider, but it's barfing. I was able to get the test
> to pass by changing "AWSEC2Api client = view.unwrapApi(AWSEC2Api.class)" to
> "AWSEC2Api client = (AWSEC2Api)view.unwrapApi(EC2Api.class)" but that feels
> like cheating, and makes me worry about actual use cases...
What is view.getBackendType() returning?
ap
Re: Strange error in AWS EC2 live tests
Posted by Andrew Bayer <an...@gmail.com>.
Nope, that's not the case. Looking at
https://github.com/jclouds/jclouds/blob/master/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/extensions/AWSEC2ImageExtensionLiveTest.java#L43,
it's got the right provider, but it's barfing. I was able to get the test
to pass by changing "AWSEC2Api client = view.unwrapApi(AWSEC2Api.class)" to
"AWSEC2Api client = (AWSEC2Api)view.unwrapApi(EC2Api.class)" but that feels
like cheating, and makes me worry about actual use cases...
A.
On Thu, Sep 26, 2013 at 3:21 PM, Andrew Bayer <an...@gmail.com>wrote:
> No, it isn't - there's no getApi() on the return from unwrap().
>
> Lemme see if I can find anything referencing "ec2"...
>
> A.
>
>
> On Thu, Sep 26, 2013 at 3:19 PM, Andrew Bayer <an...@gmail.com>wrote:
>
>> Hrm. Maybe Intellij's lying to me...
>>
>> A.
>>
>>
>> On Thu, Sep 26, 2013 at 2:43 PM, Andrew Phillips <ap...@qrmedia.com>wrote:
>>
>>> There is no view.unwrap().getApi() any more. =)
>>>>
>>>
>>> https://github.com/jclouds/**jclouds/blob/master/core/src/**
>>> main/java/org/jclouds/View.**java#L71<https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/View.java#L71>
>>>
>>> ? Or are you talking about your fork here..?
>>>
>>> ap
>>>
>>
>>
>
Re: Strange error in AWS EC2 live tests
Posted by Andrew Bayer <an...@gmail.com>.
No, it isn't - there's no getApi() on the return from unwrap().
Lemme see if I can find anything referencing "ec2"...
A.
On Thu, Sep 26, 2013 at 3:19 PM, Andrew Bayer <an...@gmail.com>wrote:
> Hrm. Maybe Intellij's lying to me...
>
> A.
>
>
> On Thu, Sep 26, 2013 at 2:43 PM, Andrew Phillips <ap...@qrmedia.com>wrote:
>
>> There is no view.unwrap().getApi() any more. =)
>>>
>>
>> https://github.com/jclouds/**jclouds/blob/master/core/src/**
>> main/java/org/jclouds/View.**java#L71<https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/View.java#L71>
>>
>> ? Or are you talking about your fork here..?
>>
>> ap
>>
>
>
Re: Strange error in AWS EC2 live tests
Posted by Andrew Bayer <an...@gmail.com>.
Hrm. Maybe Intellij's lying to me...
A.
On Thu, Sep 26, 2013 at 2:43 PM, Andrew Phillips <ap...@qrmedia.com>wrote:
> There is no view.unwrap().getApi() any more. =)
>>
>
> https://github.com/jclouds/**jclouds/blob/master/core/src/**
> main/java/org/jclouds/View.**java#L71<https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/View.java#L71>
>
> ? Or are you talking about your fork here..?
>
> ap
>
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
> There is no view.unwrap().getApi() any more. =)
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/View.java#L71
? Or are you talking about your fork here..?
ap
Re: Strange error in AWS EC2 live tests
Posted by Andrew Bayer <an...@gmail.com>.
There is no view.unwrap().getApi() any more. =)
On Thu, Sep 26, 2013 at 2:28 PM, Andrew Phillips <ap...@qrmedia.com>wrote:
> And others with that same exception - any ideas?
>>
>
> PS: Does it work if you change the test to call
>
> (AWSEC2Api) unwrap().getApi()
>
> instead of
>
> unwrapApi(AWSEC2Api.class)
>
> ..?
>
> ap
>
Re: Strange error in AWS EC2 live tests
Posted by Andrew Phillips <ap...@qrmedia.com>.
> And others with that same exception - any ideas?
PS: Does it work if you change the test to call
(AWSEC2Api) unwrap().getApi()
instead of
unwrapApi(AWSEC2Api.class)
..?
ap