I have deployed a Ceph cluster over 3 nodes and have created msd
and rgw
. I have 3 machines named ceph1, ceph2 and ceph3.
- ceph1 runs osd, mon, mds and rwg
- ceph2 runs osd
- ceph3 runs osd
I have created a user with radosgw-admin user create
command.
Now I want to access the ceph cluster using swift api and create a container. For that I wrote following java code :
import org.javaswift.joss.client.factory.AccountConfig;
import org.javaswift.joss.client.factory.AccountFactory;
import org.javaswift.joss.client.factory.AuthenticationMethod;
import org.javaswift.joss.model.Account;
import org.javaswift.joss.model.Container;
import org.javaswift.joss.model.StoredObject;
import java.io.File;
import java.io.IOException;
import java.util.*;
public class Example {
public static void main(String[] args) {
String username = "sahoo";
String password = "IM8K5GAQIXHFRAKYS761";
String authUrl = "http://ceph1:7480/";
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(authUrl);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
Account account = new AccountFactory(config).createAccount();
Container container = account.getContainer("container-name");
container.create();
}
}
But while running the code I get following exception:
Exception in thread "main" java.lang.NullPointerException
at org.javaswift.joss.command.impl.identity.BasicAuthenticationCommandImpl.getReturnObject(BasicAuthenticationCommandImpl.java:35)
at org.javaswift.joss.command.impl.identity.BasicAuthenticationCommandImpl.getReturnObject(BasicAuthenticationCommandImpl.java:18)
at org.javaswift.joss.command.impl.core.AbstractCommand.call(AbstractCommand.java:51)
at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:97)
at org.javaswift.joss.client.impl.ClientImpl.createAccount(ClientImpl.java:27)
at org.javaswift.joss.client.core.AbstractClient.authenticate(AbstractClient.java:35)
at org.javaswift.joss.client.factory.AccountFactory.createAccount(AccountFactory.java:30)
at Example.main(Example.java:24)
Can any one help me out with why I am getting the exception and exactly what we need to pass to config.setAuthUrl()
.