Hi.. I have installed devstack and I also jclouds and I am trying to run the following code :
import java.util.Set; import java.lang.Thread.UncaughtExceptionHandler; import org.jclouds.ContextBuilder; import org.jclouds.compute.ComputeService; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.openstack.nova.v2_0.features.ImageApi; import org.jclouds.openstack.nova.v2_0.domain.Image; import org.jclouds.rest.RestContext; import org.jclouds.openstack.nova.v2_0.NovaApi; import org.jclouds.openstack.nova.v2_0.NovaAsyncApi; import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import com.google.common.collect.ImmutableSet; import com.google.common.collect.FluentIterable; import com.google.inject.Module; public class JCloudsOpenStack { private ComputeService compute; private RestContext<NovaApi, NovaAsyncApi> nova; private Set<String> zones; public static void main(String[] args) { JCloudsOpenStack jCloudsOpenStack = new JCloudsOpenStack(); jCloudsOpenStack.init(); jCloudsOpenStack.listImages(); jCloudsOpenStack.close(); } private void init() { Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { if (compute != null) close(); e.printStackTrace(); System.exit(1); } }); Iterable<Module> modules = ImmutableSet.<Module> of( new SLF4JLoggingModule()); String provider = "openstack-nova"; String identity = "admin:admin"; // tenantName:userName String password = "ashwini"; ComputeServiceContext context = ContextBuilder.newBuilder(provider) .credentials(identity, password) .endpoint("http://172.16.32.87:5000/v2.0/") .modules(modules) .buildView(ComputeServiceContext.class); compute = context.getComputeService(); nova = context.unwrap(); zones = nova.getApi().getConfiguredZones(); } private void listImages() { for (String zone: zones) { ImageApi imageApi = nova.getApi().getImageApiForZone(zone); System.out.println("Calling listImages for " + zone + ":"); FluentIterable<? extends Image> images = imageApi.listInDetail().concat(); for (Image image: images) { System.out.println("\t" + image); } } } private void close() { compute.getContext().close(); } } I am getting the following error : Exception: java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in thread "main" Please help.. Thank you Avanti