简体   繁体   中英

OpenStack throws NullPointerException when connecting

I'm trying to connect OpenStack before creating tenant. It gives a NullPointerException from OpenStackClient.request() in the "openstack-client-3.2.1.jar".

The code and the beginning of stack trace are as below:

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

The stacktrace is:

 [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)

It was required to add one of the three libraries (ie openstack-client-connectors) listed below:

jersey-connector

jersey2-connector

resteasy-connector

The variable userA is null. You need to properly initialize it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM