ContainX / openstack4j

A Fluent OpenStack SDK / Client Library for Java
http://openstack4j.com
Other
290 stars 366 forks source link

Creating server fails with: URI template of the newly created target must not be null #38

Closed gtoff closed 10 years ago

gtoff commented 10 years ago

EDIT ---- found the problem in my code

I cannot seem to create a server against DevStack IceHouse. Connecting, auth, and getting list of servers / flavors works.

I tried both with stable release (1.0.1) and 1.0.2.snap. What am I doing wrong?

thx.

Code:

// Create a Server Model Object ServerCreateBuilder sb = os.compute().servers().serverBuilder(); ServerCreate sc = sb.name(request.getVEEType()) .flavor(this.flavors.get(0).getId()) .image("9d796431-c655-45b9-8d94-e7982742264b") .addPersonality("/etc/motd", "Welcome to the new VM! Restricted access only") .build();

// Boot the Server
Server server = os.compute().servers().boot(sc);

Exception Thrown:

java.lang.NullPointerException: URI template of the newly created target must not be null. at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208) at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:179) at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:69) at org.openstack4j.core.transport.internal.HttpExecutor.invoke(HttpExecutor.java:74) at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:53) at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:44) at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:136) at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:131) at org.openstack4j.openstack.compute.internal.ServerServiceImpl.boot(ServerServiceImpl.java:65)

gtoff commented 10 years ago

My bad. Apparently that's the error I get for tryying to reuse an "OSClient" object in a different method. I'm recreating it each time and it works.