连接时,OpenStack会抛出NullPointerException

时间:2014-09-19 15:40:18

标签: java nullpointerexception openstack

我在创建租户之前尝试连接OpenStack。它在" openstack-client-3.2.1.jar"中提供NullPointerException OpenStackClient.request()

代码和堆栈跟踪的开头如下:

UsernamePassword usernamePassword = new UsernamePassword(userA,passA)
com.woorea.openstack.keystone.model.Access access = 
    keystone
     .tokens()
     .authenticate(usernamePassword)
     .execute();

堆栈跟踪是:

 [java] java.lang.NullPointerException
 [java]     at com.woorea.openstack.base.client.OpenStackClient.request(OpenStackClient.java:51)
 [java]     at com.woorea.openstack.base.client.OpenStackClient.execute(OpenStackClient.java:66)
 [java]     at com.woorea.openstack.base.client.OpenStackRequest.execute(OpenStackRequest.java:98)
 [java]     at vep.openstack.OpenStackConnector.addUser(OpenStackConnector.java:624)

2 个答案:

答案 0 :(得分:1)

需要添加下面列出的三个库中的一个(即openstack-client-connectors):

Jersey的连接器

jersey2连接器

RestEasy的连接器

答案 1 :(得分:0)

变量userA为空。您需要正确初始化它。