Re: Can not create SwiftApi with tempauth
Thank you. I forced to use Gson 2.5 but now I have problems with regions. When I use: Set regions = swiftApi.getConfiguredRegions(); I get an error: Request processing failed; nested exception is org.jclouds.http.HttpResponseException: command: POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [Bad RequestThe server could not comply with the request since it is either malformed or otherwise incorrect.]] with root cause org.jclouds.http.HttpResponseException: command: POST http://192.168.0.58:8080/auth/v1.0/tokens HTTP/1.1 failed with response: HTTP/1.1 400 Bad Request; content: [Bad RequestThe server could not comply with the request since it is either malformed or otherwise incorrect.] at org.jclouds.openstack.swift.v1.handlers.SwiftErrorHandler.handleError(SwiftErrorHandler.java:46) 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.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156) at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123) at com.sun.proxy.$Proxy111.authenticateWithTenantNameAndCredentials(Unknown Source) at org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:43) at org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:31) at org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:79) at org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:36) at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:148) 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 com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) at org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:234) at org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:231) at org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:94) at org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:54) 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
Re: Can not create SwiftApi with tempauth
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 Porunovwrote: > 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 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 >> 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.(Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V >> > at >> > >> > org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.(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 >> > >> >
Re: Can not create SwiftApi with tempauth
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 Porunovwrote: > 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.(Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V > at > org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory.(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