jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: Can not create SwiftApi with tempauth
Date Wed, 14 Sep 2016 18:13:26 GMT
If you use Spring Boot 1.4, then you might be affected by JCLOUDS-1160
[1], as it comes with a Gson version newer than the one supported by
jclouds. See the issue and the linked one for more details.

If that is your case, is there any chance you can force a version of
Gson <= 2.5?



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

On 14 September 2016 at 20:07, Alexandr Porunov
<alexandr.porunov@gmail.com> wrote:
> I use 1.9.2 version of jclouds as in the example.
> Here is my gradle dependencies:
>
> compile group: 'org.apache.jclouds.driver', name: 'jclouds-slf4j', version:
> '1.9.2'
> compile group: 'org.apache.jclouds.driver', name: 'jclouds-sshj', version:
> '1.9.2'
> compile group: 'org.apache.jclouds.api', name: 'openstack-swift', version:
> '1.9.2'
> compile group: 'org.apache.jclouds.labs', name: 'openstack-marconi',
> version: '1.9.2'
>
>
> I don't use gson. But I use spring-boot framework. It may use gson. I am not
> sure. But I don't see it in External Libraries.
>
> Also I tried to use:
> SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
>                 .endpoint("http://192.168.0.58:8080/auth/v1.0")
>                 .credentials("admin:admin", "admin")
>                 .buildApi(SwiftApi.class);
>
> It shows the same error.
>
> My OpenStack Swift works if I use curl:
>
> //authenticate
> curl -v -H 'X-Auth-User: admin:admin' -H 'X-Auth-Key: admin'
> http://192.168.0.58:8080/auth/v1.0/
>
> //check containers
> curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad'
> http://192.168.0.58:8080/v1/AUTH_admin/
>
> //create a container
> curl -v -H 'X-Storage-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X PUT
> http://192.168.0.58:8080/v1/AUTH_admin/mycontainer
>
> //upload file
> swift -A http://192.168.0.58:8080/auth/v1.0/ -U admin:admin -K admin upload
> mycontainer some_file
>
> //get file
> curl -v -H 'X-Auth-Token: AUTH_tk1411104de43046aca9b371c27c3b1fad' -X GET
> http://192.168.0.58:8080/v1/AUTH_admin/mycontainer/some_file
>
> Sincerely,
> Alexandr
>
>
> On Wed, Sep 14, 2016 at 8:56 PM, Ignasi Barrera <nacx@apache.org> wrote:
>>
>> Which version of jclouds are you using? Are you using Gson too in your
>> project? In that case, which version of Gson are you using?
>>
>> On 14 September 2016 at 19:45, Alexandr Porunov
>> <alexandr.porunov@gmail.com> wrote:
>> > Hello,
>> >
>> > How to use jclouds with OpenStack Swift?
>> >
>> > Here is my code:
>> > SwiftApi swiftApi = ContextBuilder.newBuilder("openstack-swift")
>> >                 .endpoint("http://192.168.0.58:8080/v1/")
>> >                 .credentials("admin:admin", "admin")
>> >                 .buildApi(SwiftApi.class);
>> >
>> > I use tempauth in OpenStack Swift. Here is my configs:
>> > [filter:tempauth]
>> > use = egg:swift#tempauth
>> > user_admin_admin = admin .admin .reseller_admin
>> > user_test_tester = testing .admin
>> > user_test2_tester2 = testing2 .admin
>> > user_test_tester3 = testing3
>> >
>> > I can not create swiftApi because I always get next error:
>> > Exception in thread "main" java.lang.reflect.InvocationTargetException
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> >         at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >         at java.lang.reflect.Method.invoke(Method.java:497)
>> >         at
>> >
>> > org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
>> >         at
>> > org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
>> >         at
>> > org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
>> >         at
>> > org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
>> > Caused by: java.lang.NoSuchMethodError:
>> >
>> > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.<init>(Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V
>> >         at
>> >
>> > org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.<init>(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:116)
>> >         at
>> > org.jclouds.json.config.GsonModule.provideGson(GsonModule.java:129)
>> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >         at
>> >
>> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> >         at
>> >
>> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >         at java.lang.reflect.Method.invoke(Method.java:497)
>> >         at
>> > com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
>> >         at
>> >
>> > com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
>> >         at
>> >
>> > com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
>> >         at
>> >
>> > com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
>> >         at
>> >
>> > com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
>> >         at com.google.inject.Scopes$1$1.get(Scopes.java:65)
>> >         at
>> >
>> > com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
>> >         at
>> >
>> > com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
>> >         at
>> >
>> > com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
>> >         at
>> >
>> > com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
>> >         at
>> >
>> > com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
>> >         at
>> >
>> > com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
>> >         at
>> >
>> > com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
>> >         at
>> >
>> > com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
>> >         at com.google.inject.Scopes$1$1.get(Scopes.java:65)
>> >         at
>> >
>> > com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
>> >         at
>> > com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
>> >         at
>> >
>> > com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:204)
>> >         at
>> >
>> > com.google.inject.internal.InternalInjectorCreator$1.call(InternalInjectorCreator.java:198)
>> >         at
>> >
>> > com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
>> >         at
>> >
>> > com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:198)
>> >         at
>> >
>> > com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:179)
>> >         at
>> >
>> > com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
>> >         at com.google.inject.Guice.createInjector(Guice.java:95)
>> >         at
>> > org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:402)
>> >         at
>> > org.jclouds.ContextBuilder.buildInjector(ContextBuilder.java:326)
>> >         at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:644)
>> >         at org.jclouds.ContextBuilder.buildApi(ContextBuilder.java:636)
>> >         at com.fyfine.loader.Application.main(Application.java:26)
>> >         ... 8 more
>> >
>> > Please, help me connect to OpenStack Swift
>> >
>> > Sincerely,
>> > Alexandr
>
>

Mime
View raw message