How to Connect and Uploading Files to Openstack using Java

Currently im involved in a project where i have to use OpenStack Object Store for storing images and files. After Googling for a while, i come up with a solution of using JOSS library to connect to OpenStack, despite OpenStack provide REST API to connect to it directly.

But first, we need to see the API URL that is needed for login to OpenStack. And it can be seen on below screenshot, inside the red box.

After we got the url, next is importing JOSS library to be used in our app. We can import it by using a simple maven command,


And a simple java file, to do a simple upload using a provided credential.

public void uploadImageToDCTest() {
	AccountConfig config = new AccountConfig();

	Account account = new AccountFactory(config).createAccount();

	Container container = account.getContainer("images");
	if(!container.exists()) {

	StoredObject object = container.getObject("jenkins-logo.png");
	object.uploadObject(new File("D:\\jenkins-logo.png"));
	System.out.println("Public URL: "+object.getPublicURL());

Later on, we can check the result on our OpenStack object store page.

No Comments

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked