Hello,
I am getting the following error while running JCloudsNova

java -classpath ".:lib/*:/usr/local/jdk1.8.0_171/lib" JCloudsNova
09:04:54.875 [main] DEBUG o.j.rest.internal.InvokeHttpMethod - >> invoking 
V2AuthenticationApi.authenticatePassword
09:04:54.878 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Sending 
request -263010527: POST http://192.168.0.12:5000/v2.0/tokens HTTP/1.1
09:04:54.878 [main] DEBUG jclouds.wire - >> "Sensitive data in payload, use 
jclouds.wire.log.sensitive override to enable logging this data."
09:04:54.878 [main] DEBUG jclouds.headers - >> POST 
http://192.168.0.12:5000/v2.0/tokens HTTP/1.1
09:04:54.878 [main] DEBUG jclouds.headers - >> Accept: application/json
09:04:54.878 [main] DEBUG jclouds.headers - >> Content-Type: application/json
09:04:54.878 [main] DEBUG jclouds.headers - >> Content-Length: 94
09:04:54.978 [main] DEBUG o.j.h.i.JavaUrlHttpCommandExecutorService - Receiving 
response -263010527: HTTP/1.1 404 Not Found
09:04:54.979 [main] DEBUG jclouds.headers - << HTTP/1.1 404 Not Found
09:04:54.979 [main] DEBUG jclouds.headers - << Keep-Alive: timeout=15, max=100
09:04:54.979 [main] DEBUG jclouds.headers - << Server: Apache/2.4.6 (CentOS)
09:04:54.979 [main] DEBUG jclouds.headers - << Connection: Keep-Alive
09:04:54.979 [main] DEBUG jclouds.headers - << x-openstack-request-id: 
req-50bbce32-c67b-4b18-90cd-fa0911f842a0
09:04:54.979 [main] DEBUG jclouds.headers - << Vary: X-Auth-Token
09:04:54.979 [main] DEBUG jclouds.headers - << Date: Tue, 19 Jun 2018 03:34:54 
GMT
09:04:54.979 [main] DEBUG jclouds.headers - << Content-Type: application/json
09:04:54.979 [main] DEBUG jclouds.headers - << Content-Length: 133
09:04:54.982 [main] DEBUG jclouds.wire - << "{"error": {"message": 
"(http://192.168.0.12:5000/v2.0/tokens): The resource could not be found.", 
"code": 404, "title": "Not Found"}}"
Exception in thread "main" org.jclouds.rest.ResourceNotFoundException: 
{"error": {"message": "(http://192.168.0.12:5000/v2.0/tokens): The resource 
could not be found.", "code": 404, "title": "Not Found"}}
    at 
org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:97)
    at 
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
    at 
org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:138)
    at 
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:107)
    at 
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
    at 
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
    at 
org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
    at com.sun.proxy.$Proxy57.authenticatePassword(Unknown Source)
    at 
org.jclouds.openstack.keystone.auth.functions.AuthenticatePasswordCredentials.authenticate(AuthenticatePasswordCredentials.java:48)
    at 
org.jclouds.openstack.keystone.auth.functions.BaseAuthenticator.apply(BaseAuthenticator.java:87)
    at 
org.jclouds.openstack.keystone.auth.functions.BaseAuthenticator.apply(BaseAuthenticator.java:38)
    at 
com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:151)
    at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at 
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
    at 
org.jclouds.openstack.keystone.auth.config.AuthenticationModule$2.get(AuthenticationModule.java:138)
    at 
org.jclouds.openstack.keystone.auth.config.AuthenticationModule$2.get(AuthenticationModule.java:135)
    at 
org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog.get(V2ServiceCatalog.java:57)
    at 
org.jclouds.openstack.keystone.v2_0.catalog.V2ServiceCatalog.get(V2ServiceCatalog.java:42)
    at 
org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:76)
    at 
org.jclouds.openstack.keystone.catalog.suppliers.LocationIdToURIFromServiceEndpointsForTypeAndVersion.get(LocationIdToURIFromServiceEndpointsForTypeAndVersion.java:46)
    at 
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
    at 
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:57)
    at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at 
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
    at 
org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:45)
    at 
org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:33)
    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:57)
    at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    at 
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:150)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.getInstanceOfTypeWithQualifier(DelegatesToInvocationFunction.java:277)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.lookupValueFromGuice(DelegatesToInvocationFunction.java:234)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:152)
    at 
org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
    at com.sun.proxy.$Proxy59.getConfiguredRegions(Unknown Source)
    at JCloudsNova.<init>(JCloudsNova.java:44)
    at JCloudsNova.main(JCloudsNova.java:19)
Caused by: org.jclouds.http.HttpResponseException: command: POST 
http://192.168.0.12:5000/v2.0/tokens HTTP/1.1 failed with response: HTTP/1.1 
404 Not Found; content: [{"error": {"message": 
"(http://192.168.0.12:5000/v2.0/tokens): The resource could not be found.", 
"code": 404, "title": "Not Found"}}]
    at 
org.jclouds.openstack.nova.v2_0.handlers.NovaErrorHandler.handleError(NovaErrorHandler.java:78)
    ... 57 more
[root@localhost jclouds]# 
 

    On Tuesday, June 19, 2018 2:26 PM, Andrea Turli <andrea.tu...@gmail.com> 
wrote:
 

 Why are you using 

<dependency>    <groupId>org.apache.jclouds.api</groupId>    
<artifactId>openstack-neutron</artifactId>    
<version>2.0.1</version></dependency>

if your jclouds.properties is 2.1.0 ?

I think 

<dependency>    <groupId>org.apache.jclouds.api</groupId>    
<artifactId>openstack-neutron</artifactId>      
<version>${jclouds.version}</version></dependency>

should fix the mvn dependency command
Best
On Tue, Jun 19, 2018 at 10:52 AM jayshankar nair <n_jayshan...@yahoo.com> wrote:

Hello,
After changing the groupid for neutron, I am getting the  error while executing 
maven. The lib directory content is as below.

[root@localhost jclouds]# mvn dependency:copy-dependencies 
"-DoutputDirectory=./lib"
[INFO] Scanning for projects...
[INFO] 
[INFO] -----------< org.apache.jclouds.examples:openstack-examples >-----------
[INFO] Building openstack-examples 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.apache.jclouds.api:openstack-neutron:jar:2.0.1 is 
missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.707 s
[INFO] Finished at: 2018-06-19T08:36:36+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project openstack-examples: Could not resolve 
dependencies for project 
org.apache.jclouds.examples:openstack-examples:jar:1.0: Failure to find 
org.apache.jclouds.api:openstack-neutron:jar:2.0.1 in 
https://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of central has 
elapsed or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

 

    On Tuesday, June 19, 2018 11:11 AM, Ignasi Barrera <n...@apache.org> wrote:
 

 That tutorial is a bit outdated. Did you use the exact pom.xml referenced 
there to build the "lib" folder?
A quick look shows that the Neutron groupId is wrong. Now it is 
"org.apache.jclouds.api". Could you verify it, and that you get all deps 
without errors? Could you share the contents of the resulting "lib" folder you 
have?



On Tue, Jun 19, 2018, 06:04 jayshankar nair <n_jayshan...@yahoo.com> wrote:

The description of jclouds is given in the below 
link.https://jclouds.apache.org/guides/openstack/. I have packstack installed 
in the machine.
java -classpath ".:lib/*" JCloudsNovaException in thread "main" 
java.util.ServiceConfigurationError: org.jclouds.apis.ApiMetadata: Provider 
org.jclouds.openstack.neutron.v2.NeutronApiMetadata could not be instantiated 
at java.util.ServiceLoader.fail(ServiceLoader.java:232) at 
java.util.ServiceLoader.access$100(ServiceLoader.java:185) at 
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384) at 
java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at 
java.util.ServiceLoader$1.next(ServiceLoader.java:480) at 
com.google.common.collect.ImmutableCollection$Builder.addAll(ImmutableCollection.java:281)at
 
com.google.common.collect.ImmutableCollection$ArrayBasedBuilder.addAll(ImmutableCollection.java:360)
 at 
com.google.common.collect.ImmutableSet$Builder.addAll(ImmutableSet.java:508) at 
org.jclouds.apis.Apis.all(Apis.java:72) at 
org.jclouds.apis.Apis.withId(Apis.java:88) at 
org.jclouds.ContextBuilder.newBuilder(ContextBuilder.java:169) at 
JCloudsNova.(JCloudsNova.java:39) at 

JCloudsNova.main(JCloudsNova.java:19)Caused by: java.lang.NoClassDefFoundError: 
org/jclouds/openstack
/keystone/v2_0/config/AuthenticationApiModule at 
org.jclouds.openstack.neutron.v2.NeutronApiMetadata$Builder.(NeutronApiMetadata.java:78)
 at 
org.jclouds.openstack.neutron.v2.NeutronApiMetadata.(NeutronApiMetadata.java:51)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at 
java.lang.Class.newInstance(Class.java:442) at 
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)  ... 
10 moreCaused by: java.lang.ClassNotFoundException: 
org.jclouds.openstack.keystone.v2_0.config.AuthenticationApiModule at 
java.net.URLClassLoader.findClass(URLClassLoader.java:381) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at 
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 18 more 


   


   
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());

        // Please refer to 'Keystone v2-v3 authentication' section for complete authentication use case
                 String provider = "openstack-nova";
                         String identity = "demo:demo"; // tenantName:userName
                                 String credential = "devstack";
        
                                         novaApi = ContextBuilder.newBuilder(provider)
                                                         .endpoint("http://192.168.0.12:5000/v2.0/";)
                                                                         .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);
                                                                                                                                                                                                                             }
                                                                                                                                                                                                                             }

Reply via email to