Error 401 unauthorized while connecting to swift from JOSS

asked 2017-09-13 01:57:23 -0500

bharati gravatar image

updated 2017-09-15 04:07:37 -0500

I have installed devstack in my laptop in a virtual machine with swift enabled. I am able to access all the compute,network and object storage from Horizon. I installed JOSS(Java Openstack Storage Service) in my virtual machine and like to access the swift from it.But it is giving me error unauthorized.The screen shot of my user API access is attached. The code used to access is given with the error.

Code

 Account account = new AccountFactory()
                .setUsername("bharati")
                .setPassword("bharati")
                .setAuthUrl("http://10.0.2.15:8080/v1/AUTH_e10b4191a86849e0832bdf19091165b5")
                //.setTenantId("6df3ed915ce3479a8611b46b9cc8c930")
                .setTenantName("swiftprojecttest1")
                .createAccount();

JOSS / Attempting authentication with tenant name: swiftprojecttest1, tenant ID: null, username: bharati, Auth URL: http://10.0.2.15:8080/v1/AUTH_e10b4191a86849e0832bdf19091165b5 (http://10.0.2.15:8080/v1/AUTH_e10b419...) Exception in thread "main" Command exception, HTTP Status code: 401 => UNAUTHORIZED at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.javaswift.joss.exception.HttpStatusToExceptionMapper.getException(HttpStatusToExceptionMapper.java:48) at org.javaswift.joss.exception.HttpStatusExceptionUtil.getException(HttpStatusExceptionUtil.java:16) at org.javaswift.joss.exception.HttpStatusExceptionUtil.throwException(HttpStatusExceptionUtil.java:10) at org.javaswift.joss.command.impl.core.httpstatus.HttpStatusChecker.isOk(HttpStatusChecker.java:30) at org.javaswift.joss.command.impl.core.httpstatus.HttpStatusChecker.verifyCode(HttpStatusChecker.java:38) at org.javaswift.joss.command.impl.core.AbstractCommand.call(AbstractCommand.java:50) at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:98) at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:1) at org.javaswift.joss.client.core.AbstractClient.authenticate(AbstractClient.java:35) at org.javaswift.joss.client.factory.AccountFactory.createAccount(AccountFactory.java:30) at org.javaswift.joss.App.main(App.java:26)

test-2

AccountConfig config = new AccountConfig();
        config.setUsername("bharati");
        config.setPassword("bharati");
        config.setAuthUrl("http://10.0.2.15/identity/V1.0/tokens");
        config.setTenantName("swiftprojecttest1");
        config.setAuthenticationMethod(AuthenticationMethod.KEYSTONE);
        Account account = new AccountFactory(config).createAccount();

JOSS / Attempting authentication with tenant name: swiftprojecttest1, tenant ID: null, username: bharati, Auth URL: http://10.0.2.15/identity/V1.0/tokens Exception in thread "main" Command exception, HTTP Status code: 404 => UNKNOWN at org.javaswift.joss.command.impl.core.httpstatus.HttpStatusChecker.verifyCode(HttpStatusChecker.java:45) at org.javaswift.joss.command.impl.core.AbstractCommand.call(AbstractCommand.java:50) at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:98) at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:1) at org.javaswift.joss.client.core.AbstractClient.authenticate(AbstractClient.java:35) at org.javaswift.joss.client.factory.AccountFactory.createAccount(AccountFactory.java:30) at org.javaswift.joss.App.main(App.java:35)

**test3**

  AccountConfig config = new AccountConfig();
        config.setUsername("bharati");
        config.setPassword("bharati");![image description](http://)

                config.setAuthUrl("http://10.0.2.15:8080/v1/AUTH_e10b4191a86849e0832bdf19091165b5");
                config.setTenantId("e10b4191a86849e0832bdf19091165b5");
                config.setTenantName("swiftprojecttest1");
                config.setAuthenticationMethod(AuthenticationMethod.TEMPAUTH);
        Account account = new AccountFactory(config).createAccount();

JOSS / Attempting authentication with tenant name: swiftprojecttest1, tenant ID: e10b4191a86849e0832bdf19091165b5, username: bharati, Auth URL: http://10.0.2.15:8080/v1/AUTH_e10b4191a86849e0832bdf19091165b5 ... (more)

edit retag flag offensive close merge delete