Ask Your Question
0

Error 404 on any openstack jcloud program I try

asked 2016-08-13 15:15:04 -0500

paula810 gravatar image

Hi

I am very new to openstack. I installed devstack and jclouds and tried a very basic program of connecting:

package openstackproject; import com.google.common.collect.ImmutableSet; import com.google.common.io.Closeables; import com.google.inject.Module; import org.jclouds.ContextBuilder; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.openstack.nova.v2_0.NovaApi; import org.jclouds.openstack.nova.v2_0.domain.Server; import org.jclouds.openstack.nova.v2_0.features.ServerApi;

import java.io.Closeable; import java.io.IOException; import java.util.Set;

public class JCloudsNova implements Closeable { private final NovaApi novaApi; private final Set<string> regions;

public static void main(String[] args) throws IOException {
    JCloudsNova jcloudsNova = new JCloudsNova();

    try {
        jcloudsNova.listServers();
        jcloudsNova.close();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        jcloudsNova.close();
    }
}

public JCloudsNova() {
    Iterable<Module> modules = ImmutableSet.<Module>of(new SLF4JLoggingModule());

    String provider = "openstack-nova";
    String identity = "admin:admin"; // tenantName:userName
    String credential = "admin";

    novaApi = ContextBuilder.newBuilder(provider)
            .endpoint("http://192.168.0.17/identity/")
            .credentials(identity, credential)
            .modules(modules)
            .buildApi(NovaApi.class);
    regions = novaApi.getConfiguredRegions();
}

private void listServers() {
    for (String region : regions) {
        ServerApi serverApi = novaApi.getServerApi(region);

        System.out.println("Servers in " + region);

        for (Server server : serverApi.listInDetail().concat()) {
            System.out.println("  " + server);
        }
    }
}

public void close() throws IOException {
    Closeables.close(novaApi, true);
}

}

However , I get the same error every time and for every program. Can some one please help regarding this. Where is the fault and how to solve it. Please help

ERROR: {"error": {"message": "The resource could not be found.", "code": 404, "title": "Not Found"}}"

I am pretty sure its because of the tenant /user name but I dont know how to solve it

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-08-15 03:33:22 -0500

Hamzoz gravatar image

your URL it's not correct : .endpoint("http://192.168.0.17/identity/") try this : .endpoint("http://192.168.0.17:5000/v2.0/")

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-08-13 15:15:04 -0500

Seen: 87 times

Last updated: Aug 15 '16