You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Jeremiah Robertson <jr...@gmail.com> on 2014/04/18 20:59:02 UTC

jclouds: Incorrect parsing

I have a jclouds parsing error. Jclouds tries to parse the following JSON
(except with values for the username and credential; I just removed them
for this example):
{auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}

It tries to parse it using the CollectionTypeAdapterFactory in the gson
package which is wrong because it should be using the
DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds
core. The type token used to find the adapter is correct though:
org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.

So I'm not sure why it's receiving the wrong adapter. Any ideas?

Thank you,

-- 
Jeremiah Robertson
Georgia Tech
Aerospace Engineering

Re: jclouds: Incorrect parsing

Posted by Everett Toews <ev...@RACKSPACE.COM>.
Hi Jeremiah,

Considering the problems you’re having with logging on Android, you might want to take a different approach. I can think of a couple of options.

1. Run a HTTP(S) proxy

Read the HTTP(S) section [1] of the Logging doc. Then you’d need to enable the proxy on your Android one way [2] or another [3].

2. Use a third party service like Runscope

Run your requests through something like Runscope [4]. I think you’d just have to set your endpoint to something like

"https://yourapihere-com-bucket_key.runscope.net”

but I’ve never actually tried it.

HTH,
Everett

[1] http://jclouds.apache.org/reference/logging/#proxy
[2] http://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration/
[3] http://jaanus.com/blog/2012/02/12/debugging-http-on-an-android-phone-or-tablet-with-charles-proxy-for-fun-and-profit/
[4] https://www.runscope.com/docs/code-examples/android


On Apr 18, 2014, at 4:48 PM, Jeremiah Robertson <jr...@gmail.com>> wrote:

Here is what I'm using to build the context:

String provider = System.getProperty("provider.cs", rackspaceprovider);
       String endpoint = "https://identity.api.rackspacecloud.com/v2.0/";
       String username = usernames;
       String credential = apikey;
       try{
       ComputeServiceContext context = ContextBuilder.newBuilder(provider)
      .endpoint(endpoint)
               .credentials(username, credential)
               .modules(ImmutableSet.of(new OkHttpCommandExecutorServiceModule(), new SLF4JLoggingModule()))
               .buildView(ComputeServiceContext.class);
       computeService = context.getComputeService();
       nova = context.unwrap();

Then here is the snippet where the error occurs: nova.getApi().getConfiguredZones()

So the context and the novaApi build fine, but when I call the getconfiguredzones it produces the error.

I can't seem to get enable logging since I'm using Android and it produces errors when trying to use ch.qos.logback. I will see if I can enable it so I can get the log. Thank you.


On Fri, Apr 18, 2014 at 3:22 PM, Everett Toews <ev...@rackspace.com>> wrote:
Hi Jeremiah,

In cases of JSON parsing problems we really need to see the wire logging, here’s how to configure logging [1]. The file we need log/jclouds-wire.log.

Also, it would be helpful to see a full example that demonstrates the problem. Or at least a snippet that shows how you’re building your Context and what you’re calling afterwards that’s causing the problem.

Thanks,
Everett

[1] http://jclouds.apache.org/reference/logging/


On Apr 18, 2014, at 2:10 PM, Jeremiah Robertson <jr...@gmail.com>> wrote:

Yes, I'm using jclouds 1.7.1 and I'm using rackspace-cloudservers-us as the provider. And at the base level I'm calling nova.getApi().getConfiguredZones(). I also attached the stack trace. It produces the BEGIN_ARRAY but BEGIN_OBJECT was expected error because it should be using the Deserialization adapter.


On Fri, Apr 18, 2014 at 3:03 PM, Ignasi Barrera <na...@apache.org>> wrote:

Hi Jeremiah,

Which version of jclouds and which provider are you using?

And could you share too which api class and method are you calling when you get the parsing failure? A stacktrace will help!

I.

El 18/04/2014 20:59, "Jeremiah Robertson" <jr...@gmail.com>> escribió:

I have a jclouds parsing error. Jclouds tries to parse the following JSON (except with values for the username and credential; I just removed them for this example): {auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}

It tries to parse it using the CollectionTypeAdapterFactory in the gson package which is wrong because it should be using the DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds core. The type token used to find the adapter is correct though: org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.

So I'm not sure why it's receiving the wrong adapter. Any ideas?

Thank you,

--
Jeremiah Robertson
Georgia Tech
Aerospace Engineering



--
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com<ma...@gmail.com>
417.207.1563<tel:417.207.1563>
<log.txt>




--
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com<ma...@gmail.com>
417.207.1563<tel:417.207.1563>


Re: jclouds: Incorrect parsing

Posted by Jeremiah Robertson <jr...@gmail.com>.
Here is what I'm using to build the context:

String provider = System.getProperty("provider.cs", rackspaceprovider);
       String endpoint = "https://identity.api.rackspacecloud.com/v2.0/";
       String username = usernames;
       String credential = apikey;
       try{
       ComputeServiceContext context = ContextBuilder.newBuilder(provider)
       .endpoint(endpoint)
               .credentials(username, credential)
               .modules(ImmutableSet.of(new
OkHttpCommandExecutorServiceModule(), new SLF4JLoggingModule()))
               .buildView(ComputeServiceContext.class);
       computeService = context.getComputeService();
       nova = context.unwrap();

Then here is the snippet where the error
occurs: nova.getApi().getConfiguredZones()

So the context and the novaApi build fine, but when I call the
getconfiguredzones it produces the error.

I can't seem to get enable logging since I'm using Android and it produces
errors when trying to use ch.qos.logback. I will see if I can enable it so
I can get the log. Thank you.


On Fri, Apr 18, 2014 at 3:22 PM, Everett Toews
<ev...@rackspace.com>wrote:

>  Hi Jeremiah,
>
>  In cases of JSON parsing problems we really need to see the wire
> logging, here’s how to configure logging [1]. The file we
> need log/jclouds-wire.log.
>
>  Also, it would be helpful to see a full example that demonstrates the
> problem. Or at least a snippet that shows how you’re building your Context
> and what you’re calling afterwards that’s causing the problem.
>
>  Thanks,
> Everett
>
>  [1] http://jclouds.apache.org/reference/logging/
>
>
>  On Apr 18, 2014, at 2:10 PM, Jeremiah Robertson <jr...@gmail.com> wrote:
>
>  Yes, I'm using jclouds 1.7.1 and I'm using rackspace-cloudservers-us as
> the provider. And at the base level I'm
> calling nova.getApi().getConfiguredZones(). I also attached the stack
> trace. It produces the BEGIN_ARRAY but BEGIN_OBJECT was expected error
> because it should be using the Deserialization adapter.
>
>
> On Fri, Apr 18, 2014 at 3:03 PM, Ignasi Barrera <na...@apache.org> wrote:
>
>> Hi Jeremiah,
>>
>> Which version of jclouds and which provider are you using?
>>
>> And could you share too which api class and method are you calling when
>> you get the parsing failure? A stacktrace will help!
>>
>> I.
>> El 18/04/2014 20:59, "Jeremiah Robertson" <jr...@gmail.com> escribió:
>>
>>  I have a jclouds parsing error. Jclouds tries to parse the following
>>> JSON (except with values for the username and credential; I just removed
>>> them for this example):
>>> {auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}
>>>
>>>  It tries to parse it using the CollectionTypeAdapterFactory in the
>>> gson package which is wrong because it should be using the
>>> DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds
>>> core. The type token used to find the adapter is correct though:
>>> org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.
>>>
>>>  So I'm not sure why it's receiving the wrong adapter. Any ideas?
>>>
>>>  Thank you,
>>>
>>>  --
>>> Jeremiah Robertson
>>> Georgia Tech
>>> Aerospace Engineering
>>>
>>
>
>
>  --
> Jeremiah Robertson
> Georgia Tech Junior
> Aerospace Engineering
> Grand Challenges Program
> jrspfd@gmail.com
> 417.207.1563
> <log.txt>
>
>
>


-- 
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com
417.207.1563

Re: jclouds: Incorrect parsing

Posted by Everett Toews <ev...@RACKSPACE.COM>.
Hi Jeremiah,

In cases of JSON parsing problems we really need to see the wire logging, here’s how to configure logging [1]. The file we need log/jclouds-wire.log.

Also, it would be helpful to see a full example that demonstrates the problem. Or at least a snippet that shows how you’re building your Context and what you’re calling afterwards that’s causing the problem.

Thanks,
Everett

[1] http://jclouds.apache.org/reference/logging/


On Apr 18, 2014, at 2:10 PM, Jeremiah Robertson <jr...@gmail.com>> wrote:

Yes, I'm using jclouds 1.7.1 and I'm using rackspace-cloudservers-us as the provider. And at the base level I'm calling nova.getApi().getConfiguredZones(). I also attached the stack trace. It produces the BEGIN_ARRAY but BEGIN_OBJECT was expected error because it should be using the Deserialization adapter.


On Fri, Apr 18, 2014 at 3:03 PM, Ignasi Barrera <na...@apache.org>> wrote:

Hi Jeremiah,

Which version of jclouds and which provider are you using?

And could you share too which api class and method are you calling when you get the parsing failure? A stacktrace will help!

I.

El 18/04/2014 20:59, "Jeremiah Robertson" <jr...@gmail.com>> escribió:

I have a jclouds parsing error. Jclouds tries to parse the following JSON (except with values for the username and credential; I just removed them for this example): {auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}

It tries to parse it using the CollectionTypeAdapterFactory in the gson package which is wrong because it should be using the DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds core. The type token used to find the adapter is correct though: org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.

So I'm not sure why it's receiving the wrong adapter. Any ideas?

Thank you,

--
Jeremiah Robertson
Georgia Tech
Aerospace Engineering



--
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com<ma...@gmail.com>
417.207.1563
<log.txt>


Re: jclouds: Incorrect parsing

Posted by Jeremiah Robertson <jr...@gmail.com>.
Yes, I'm using jclouds 1.7.1 and I'm using rackspace-cloudservers-us as the
provider. And at the base level I'm
calling nova.getApi().getConfiguredZones(). I also attached the stack
trace. It produces the BEGIN_ARRAY but BEGIN_OBJECT was expected error
because it should be using the Deserialization adapter.


On Fri, Apr 18, 2014 at 3:03 PM, Ignasi Barrera <na...@apache.org> wrote:

> Hi Jeremiah,
>
> Which version of jclouds and which provider are you using?
>
> And could you share too which api class and method are you calling when
> you get the parsing failure? A stacktrace will help!
>
> I.
> El 18/04/2014 20:59, "Jeremiah Robertson" <jr...@gmail.com> escribió:
>
> I have a jclouds parsing error. Jclouds tries to parse the following JSON
>> (except with values for the username and credential; I just removed them
>> for this example):
>> {auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}
>>
>> It tries to parse it using the CollectionTypeAdapterFactory in the gson
>> package which is wrong because it should be using the
>> DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds
>> core. The type token used to find the adapter is correct though:
>> org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.
>>
>> So I'm not sure why it's receiving the wrong adapter. Any ideas?
>>
>> Thank you,
>>
>> --
>> Jeremiah Robertson
>> Georgia Tech
>> Aerospace Engineering
>>
>


-- 
Jeremiah Robertson
Georgia Tech Junior
Aerospace Engineering
Grand Challenges Program
jrspfd@gmail.com
417.207.1563

Re: jclouds: Incorrect parsing

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

Which version of jclouds and which provider are you using?

And could you share too which api class and method are you calling when you
get the parsing failure? A stacktrace will help!

I.
El 18/04/2014 20:59, "Jeremiah Robertson" <jr...@gmail.com> escribió:

> I have a jclouds parsing error. Jclouds tries to parse the following JSON
> (except with values for the username and credential; I just removed them
> for this example):
> {auth{RAX-KSKEY:apiKeyCredentials={username="",apiKey=""}}}
>
> It tries to parse it using the CollectionTypeAdapterFactory in the gson
> package which is wrong because it should be using the
> DeserializationConstructorAndReflectiveTypeAdapterFactory in the jclouds
> core. The type token used to find the adapter is correct though:
> org.jclouds.openstack.keystone.v2_0.domain.Access of Class<T>.
>
> So I'm not sure why it's receiving the wrong adapter. Any ideas?
>
> Thank you,
>
> --
> Jeremiah Robertson
> Georgia Tech
> Aerospace Engineering
>