Hi.. Thank you for your help. I changed my jdk version to 1.7.0_45 from 1.7.0_51 and it worked. Thanks again.
Avanti On Sat, Mar 8, 2014 at 10:41 AM, Avanti Ajay <[email protected]> wrote: > I am running the code through eclipse. I have used guava 16.0.1 jar file. > Also I have added this jar file in the referenced libraries in eclipse. It > is not in the classpath. > > > On Fri, Mar 7, 2014 at 1:17 PM, Ignasi Barrera > <[email protected]>wrote: > >> Hi Avanti, >> >> As Aled suggested, it seems to be a dependency problem. >> >> How are you running the code? And which version of the Guava dependency >> is in your app classpath? >> >> I. >> El 07/03/2014 07:40, "Avanti Ajay" <[email protected]> escribió: >> >> HI.. >>> >>> This is the stacktrace of the exception Im getting.. >>> >>> Exception in thread "main" >>> com.google.common.util.concurrent.ExecutionError: >>> com.google.common.util.concurrent.ExecutionError: >>> com.google.common.util.concurrent.ExecutionError: >>> java.lang.NoSuchMethodError: >>> com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) >>> at com.google.common.cache.LocalCache.get(LocalCache.java:3934) >>> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) >>> at >>> com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:121) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.getInstanceOfTypeWithQualifier(DelegatesToInvocationFunction.java:261) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.lookupValueFromGuice(DelegatesToInvocationFunction.java:218) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:152) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123) >>> at com.sun.proxy.$Proxy54.getConfiguredZones(Unknown Source) >>> at JCloudsOpenStack.init(JCloudsOpenStack.java:55) >>> at JCloudsOpenStack.main(JCloudsOpenStack.java:25) >>> Caused by: com.google.common.util.concurrent.ExecutionError: >>> com.google.common.util.concurrent.ExecutionError: >>> java.lang.NoSuchMethodError: >>> com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) >>> at com.google.common.cache.LocalCache.get(LocalCache.java:3934) >>> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) >>> at >>> com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:121) >>> at >>> org.jclouds.location.suppliers.derived.ZoneIdsFromZoneIdToURIKeySet.get(ZoneIdsFromZoneIdToURIKeySet.java:46) >>> at >>> org.jclouds.location.suppliers.derived.ZoneIdsFromZoneIdToURIKeySet.get(ZoneIdsFromZoneIdToURIKeySet.java:34) >>> at >>> com.google.common.base.Suppliers$SupplierComposition.get(Suppliers.java:67) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:59) >>> at >>> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) >>> at >>> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) >>> at >>> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) >>> ... 11 more >>> Caused by: com.google.common.util.concurrent.ExecutionError: >>> java.lang.NoSuchMethodError: >>> com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) >>> at com.google.common.cache.LocalCache.get(LocalCache.java:3934) >>> at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) >>> at >>> com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) >>> at >>> com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) >>> at >>> org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:234) >>> at >>> org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule$2.get(KeystoneAuthenticationModule.java:231) >>> at >>> org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:95) >>> at >>> org.jclouds.openstack.keystone.v2_0.suppliers.LocationIdToURIFromAccessForTypeAndVersion.get(LocationIdToURIFromAccessForTypeAndVersion.java:54) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75) >>> at >>> org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:59) >>> at >>> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) >>> at >>> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) >>> at >>> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) >>> ... 24 more >>> Caused by: java.lang.NoSuchMethodError: >>> com.google.common.io.Closeables.closeQuietly(Ljava/io/Closeable;)V >>> at org.jclouds.io.payloads.BasePayload.writeTo(BasePayload.java:79) >>> at >>> org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.writePayloadToConnection(JavaUrlHttpCommandExecutorService.java:293) >>> at >>> org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:208) >>> at >>> org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:72) >>> at >>> org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:140) >>> at >>> org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.invoke(InvokeSyncToAsyncHttpMethod.java:129) >>> at >>> org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:95) >>> at >>> org.jclouds.rest.internal.InvokeSyncToAsyncHttpMethod.apply(InvokeSyncToAsyncHttpMethod.java:56) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156) >>> at >>> org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123) >>> at >>> com.sun.proxy.$Proxy53.authenticateWithTenantNameAndCredentials(Unknown >>> Source) >>> at >>> org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:43) >>> at >>> org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials.authenticateWithTenantName(AuthenticatePasswordCredentials.java:31) >>> at >>> org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:79) >>> at >>> org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator.apply(BaseAuthenticator.java:36) >>> at >>> com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:148) >>> at >>> com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) >>> at >>> com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) >>> at >>> com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) >>> at >>> com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) >>> ... 38 more >>> >>> >>> Thank you.. >>> Avanti >>> >>> >>> On Fri, Feb 28, 2014 at 2:53 PM, Aled Sage <[email protected]> wrote: >>> >>>> Hi Avanti, >>>> >>>> A java.lang.NoSuchMethodError usually means that you are running with a >>>> different version on the classpath compared to the one you compiled your >>>> code against (or a mix of jclouds versions, or that you've added to the >>>> classpath a different version of a jclouds upstream dependency from what >>>> jclouds was compiled against). >>>> >>>> Could you check that please, and can you include your full exception >>>> stack trace so we can see which library/method it's complaining about. >>>> >>>> Aled >>>> >>>> p.s. If you're building with maven, also try `mvn dependency:tree` to >>>> see all the versions of all the dependencies that maven is pulling in. If >>>> something is pulled in twice with different version, that can cause such >>>> problems. >>>> >>>> >>>> >>>> On 28/02/2014 07:29, Avanti Ajay wrote: >>>> >>>>> Hi.. >>>>> >>>>> I have installed jclouds and devstack 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(); >>>>> } >>>>> } >>>>> >>>>> >>>>> But I am getting the following error : Exception: >>>>> java.lang.NoSuchMethodError thrown from the UncaughtExceptionHandler in >>>>> thread "main" >>>>> >>>>> Please help.. >>>>> >>>>> Thank you >>>>> Avanti >>>>> >>>> >>>> >>> >
