In you’re curl command you’re using tenantId. jclouds uses the tenantName. Try your curl command like this.
curl -s -X POST http://10.43.2.3:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"shital.patil", "password":"shital123"}, "tenantName":"Shital Patil"}}' -H "Content-type: application/json” If that doesn’t work, your tenantName probably isn’t what you think it is. HTH, Everett On Feb 5, 2014, at 12:23 AM, Shital Patil <[email protected]<mailto:[email protected]>> wrote: Hi Everett, Thank you for such a kind help you are offering ---------------------------------------------------------------------------------------------------------------------- Curl command I am sending and its output - curl -k -X 'POST' -v http://10.43.2.3:5000/v2.0/tokens -d'{"auth":{"passwordCredentials":{"username": "shital.patil", "password":"shital123"}, "tenantId":"8c8b7bed01954c40a9dc35e82fe81b10"}}' -H 'Content-type: application/json' "tenant": {"description": "", "enabled": true, "id": "8c8b7bed01954c40a9dc35e82fe81b10", "name": "Shital Patil"}}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://10.43.2.3:8774/v2/8c8b7bed01954c40a9dc35e82fe81b10", "region": "RegionOne", "internalURL": "http://10.43.2.3:8774/v2/8c8b7bed01954c40a9dc35e82fe81b10", "id": "6149c25bc2954b41b1766fcd1117eb3f", "publicURL": "http://10.43.2.3:8774/v2/8c8b7bed01954c40a9dc35e82fe81b10"}], "endpoints_links": [], "type": "compute", "name": "nova"}, {"endpoints": [{"adminURL": "http://10.43.2.3:9696/", "region": "RegionOne", "internalURL": "http://10.43.2.3:9696/", "id": "1e050ea2e99c4e24a763a22481002add", "publicURL": "http://10.43.2.3:9696/"}], "endpoints_links": [], "type": "network", "name": "quantum"}, {"endpoints": [{"adminURL": "http://10.43.2.15:9292/v2", "region": "RegionOne", "internalURL": "http://10.43.2.15:9292/v2", "id": "c90930778fdb4084a7c142491484fb07", "publicURL": "http://10.43.2.15:9292/v2"}], "endpoints_links": [], "type": "image", "name": "glance"}, {"endpoints": [{"adminURL": "http://10.43.2.3:8776/v1/8c8b7bed01954c40a9dc35e82fe81b10", "region": "RegionOne", "internalURL": "http://10.43.2.3:8776/v1/8c8b7bed01954c40a9dc35e82fe81b10", "id": "1312aca71aab4a5ab2f1f9014c006289", "publicURL": "http://10.43.2.3:8776/v1/8c8b7bed01954c40a9dc35e82fe81b10"}], "endpoints_links": [], "type": "volume", "name": "cinder"}, {"endpoints":* Connection #0 to host 10.43.2.3 left intact * Closing connection #0 [{"adminURL": "http://10.43.2.3:8773/services/Admin", "region": "RegionOne", "internalURL": "http://10.43.2.3:8773/services/Cloud", "id": "10bd0d9efea549a7a6c36ad039745a14", "publicURL": "http://10.43.2.3:8773/services/Cloud"}], "endpoints_links": [], "type": "ec2", "name": "ec2"}, {"endpoints": [{"adminURL": "http://10.43.2.3:35357/v2.0", "region": "RegionOne", "internalURL": "http://10.43.2.3:5000/v2.0", "id": "0f0f3cd5070046b3a26f3be5361878e0", "publicURL": "http://10.43.2.3:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "shital.patil", "roles_links": [], "id": "8b953f04ca3f40248f16497a8685b695", "roles": [{"name": "_member_"}, {"name": "Member"}], "name": "shital.patil"}, "metadata": {"is_admin": 0, "roles": ["9fe2ff9ee4384b1894a90878d3e92bab", "293ac6c460064389af2063ab46691c71"]}}} ------------------------------------------------------------------------------------------------------------------- Json object that was displayed on console with exception stack trace - [{"auth":{"passwordCredentials":{"username":"shital.patil","password":"shital123"},"tenantName":"Shital Patil"}}] ----------------------------------------------------------------------------------------------------------------- I just rebuilt the code and now getting the same exception but in different form Calling listImages for RegionOne: org.jclouds.rest.AuthorizationException: {"unauthorized": {"message": "This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.", "code": 401}} at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:98) at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69) at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:182) at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:152) at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:133) at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:99) at org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:60) at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:119) at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:70) at com.sun.proxy.$Proxy68.listInDetail(Unknown Source) at org.jclouds.examples.compute.basics.JCloudsOpenStack.listImages(JCloudsOpenStack.java:64) at org.jclouds.examples.compute.basics.JCloudsOpenStack.main(JCloudsOpenStack.java:29) Caused by: org.jclouds.http.HttpResponseException: command: GET http://10.43.2.3:8774/v2/8c8b7bed01954c40a9dc35e82fe81b10/images/detail HTTP/1.1 failed with response: HTTP/1.1 401 Unauthorized; content: [{"unauthorized": {"message": "This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.", "code": 401}}] at org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:83) ... 11 more ----------------------------------------------------------------------------------------------------------------------- On Tue, Feb 4, 2014 at 9:05 PM, Everett Toews <[email protected]<mailto:[email protected]>> wrote: On Feb 3, 2014, at 9:23 PM, Shital Patil <[email protected]<mailto:[email protected]>> wrote: > 4- I am able to access openstack using curl Can you show us exactly the curl command you’re using to auth? e.g. curl -s -X POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens -d ‘json goes here' -H "Content-type: application/json” Can you show us the exact log output from jclouds? e.g. >> "{"auth":{"passwordCredentials":{"username":"shital.patil","password":"shital123"},"tenantName":"Shital >> Patil"}}" >> POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1 >> Accept: application/json >> Content-Type: application/json >> Content-Length: 111 > I have noticed that json object sent to openstack through java code using > jclouds for authentication is same as one sent using curl. Am I missing some > jars? or should I try any newer build of examples? I’ve done my best to reproduce the problem. I created a user and tenant exactly as you have in your cloud. I’m using OpenStack Havana and jclouds 1.7.0. Connecting via curl works. curl -s -X POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"shital.patil", "password":"shital123"}, "tenantName":"Shital Patil"}}' -H "Content-type: application/json” Connecting via jclouds works (logging turned on). >> "{"auth":{"passwordCredentials":{"username":"shital.patil","password":"shital123"},"tenantName":"Shital >> Patil"}}" >> POST http://xxx.xxx.xxx.xxx:5000/v2.0/tokens HTTP/1.1 >> Accept: application/json >> Content-Type: application/json >> Content-Length: 111 If you’re JSON matches exactly like mine does above, it should work for you too. HTH, Everett
