Errors trying to access swift using jclouds
I have successfully installed Openstack on my Ubuntu server, however I have errors trying to access the swift installaion using jclouds.
Trying to troubleshoot it from the command line, I got the following error :
ERROR: openstack The resource could not be found. (HTTP 404) (Request-ID: req-0f24312c-74de-483a-b8b7-b578c8bfb37f)
relevant parts of the code is :
public Swifter() {
Iterable<module> modules = ImmutableSet.<module>of(
new SLF4JLoggingModule());
String provider = "openstack-swift";
String identity = "admin:admin"; // tenantName:userName
String credential = "OVnAhlgYvTmWTVPAgUXm";
swiftApi = ContextBuilder.newBuilder(provider)
.endpoint("http://172.16.20.171:35357/v2.0")// or 172.16.20.171
.credentials(identity, credential)
.modules(modules)
.buildApi(SwiftApi.class);
}
private void createContainer() {
System.out.println("Create Container");
ContainerApi containerApi = swiftApi.getContainerApi("RegionOne");
CreateContainerOptions options = CreateContainerOptions.Builder
.metadata(ImmutableMap.of(
"key1", "value1",
"key2", "value2"));
containerApi.create(CONTAINER_NAME, options);
System.out.println(" " + CONTAINER_NAME);
}
The output i get :
Create Container
10:57:29.210 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking AuthenticationApi.authenticateWithTenantNameAndCredentials
10:57:29.210 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending request 1934896863: POST http://172.16.20.171:35357/v2.0/tokens HTTP/1.1
10:57:29.210 [main] DEBUG jclouds.wire - >> "{"auth":{"passwordCredentials":{"username":"admin","password":"OVnAhlgYvTmWTVPAgUXm"},"tenantName":"admin"}}"
10:57:29.210 [main] DEBUG jclouds.headers - >> POST http://172.16.20.171:35357/v2.0/tokens HTTP/1.1
10:57:29.210 [main] DEBUG jclouds.headers - >> Accept: application/json
10:57:29.210 [main] DEBUG jclouds.headers - >> Content-Type: application/json
10:57:29.210 [main] DEBUG jclouds.headers - >> Content-Length: 108
10:57:29.490 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving response 1934896863: HTTP/1.1 200 OK
10:57:29.490 [main] DEBUG jclouds.headers - << HTTP/1.1 200 OK
10:57:29.490 [main] DEBUG jclouds.headers - << X-Distribution: Ubuntu
10:57:29.490 [main] DEBUG jclouds.headers - << Connection: keep-alive
10:57:29.490 [main] DEBUG jclouds.headers - << X-Openstack-Request-Id: req-b15772fc-ebc6-4805-96d3-1f187031bcc6
10:57:29.490 [main] DEBUG jclouds.headers - << Vary: X-Auth-Token
10:57:29.490 [main] DEBUG jclouds.headers - << Date: Fri, 14 Aug 2015 08:56:56 GMT
10:57:29.490 [main] DEBUG jclouds.headers - << Content-Type: application/json
10:57:29.490 [main] DEBUG jclouds.headers - << Content-Length: 1299
10:57:29.490 [main] DEBUG jclouds.wire - << "{"access": {"token": {"issued_at": "2015-08-14T08:56:56.421663", "expires": "2015-08-14T09:56:56Z", "id": "cbf8e697d82a4ab9af2d0ecdd6a1ea13", "tenant": {"description": "Admin Project", "enabled": true, "id": "b31fedd4e5ba4b54968da1ee71e35966", "name": "admin"}, "audit_ids": ["txxG4RZfTEOi9ET2zRWuJw"]}, "serviceCatalog": [{"endpoints": [{"adminURL": "http://fb10openstack.hpi.uni-potsdam.de:8080", "region": "RegionOne", "internalURL": "http://fb10openstack.hpi.uni-potsdam.de:8080/v1/AUTH_b31fedd4e5ba4b54968da1ee71e35966", "id": "34fd5550dd6549a3802605fdde6332e8", "publicURL": "http://fb10openstack.hpi.uni-potsdam.de:8080/v1/AUTH_b31fedd4e5ba4b54968da1ee71e35966"}], "endpoints_links": [], "type": "object-store", "name": "swift"}, {"endpoints": [{"adminURL": "http://fb10openstack.hpi.uni-potsdam.de:35357/v2.0", "region": "RegionOn", "internalURL": "http://fb10openstack.hpi.uni-potsdam.de:5000/v2.0", "id": "339ff8512bbc492a8714a5c74a0a81e7", "publicURL": "http://fb10openstack.hpi.uni-potsdam.de:5000/v2.0"}], "endpoints_links": [], "type": "identity", "name": "keystone"}], "user": {"username": "admin", "roles_links": [], "id": "7df74bfa18a6424b9355c2e0636d022c", "roles": [{"name": "admin"}], "name": "admin"}, "metadata": {"is_admin": 0, "roles": ["caa3b89a50bf4bb79dd9fb51d4074bbe"]}}}"
10:57:29.537 [main] DEBUG o.j.o.k.v.s.RegionIdToURIFromAccessForTypeAndVersion - endpoints for apiType object-store and version 1 ...
I'm afraid that's too little to understand what's wrong. You should provide the relevant parts of the code you wrote, log messages from swift and other details useful to debug. Edit your question and add details.
Hey smafflulli, I have edited my question as you advised. thanks in advance
Does anyone have an idea, as to how to resolve this error ?
@smaffulli. Yes that is the intention, i.e. fb10openstack.hpi.uni-potsdam is an alias for the actual ip address. I have issues with the swift client also, for example swift - v3 stat gives the error " swiftclient.service.SwiftError: 'Account not found'. This I have not been able to resolve too ! "
Looks like there is something wrong on the Swift side. Check the logs there, make sure that at least the swift client can connect and then try new code.