org.openstack4j.openstack.identity.v3.internal.RoleServiceImpl.checkProjectUserRole cannot be used
Check whether user has role assignment on project by calling checkProjectUserRole() results in NullPointerException if user has no any roles in the project. OpenStack returns the 404 error in this case.
DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> HEAD /v3//projects/79ee2c9c1ab44da3b63ebde7062f27bb/users/c1ab469b274049dba1b060a9e9abf75b/roles/349f8630a51941dcba57d749d58e8834 HTTP/1.1 DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> User-Agent: OpenStack4j / OpenStack Client DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> X-Auth-Token: gAAAAABbt3YKiv9TkcNeFc3THFirH4phgiYQtqq3QjPsZYO-YRZlEz_KrIUwqF7GMDoEwfv2lJkIOsZpIS16tWsaz1ZVOKnjKkrJ0g-7Krqik0HymHekalSluGKdkyu-7Jk3eCZcs0SsYj_hz7FNyKmdmyAQ5XogJgaJXl6m3YUHb6UviK5TEmc DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> Content-Length: 0 DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> Host: controller:5000 DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> Connection: Keep-Alive DEBUG [org.apache.http.headers] [main] http-outgoing-2 >> Accept-Encoding: gzip,deflate DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "HEAD /v3//projects/79ee2c9c1ab44da3b63ebde7062f27bb/users/c1ab469b274049dba1b060a9e9abf75b/roles/349f8630a51941dcba57d749d58e8834 HTTP/1.1[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "User-Agent: OpenStack4j / OpenStack Client[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "X-Auth-Token: gAAAAABbt3YKiv9TkcNeFc3THFirH4phgiYQtqq3QjPsZYO-YRZlEz_KrIUwqF7GMDoEwfv2lJkIOsZpIS16tWsaz1ZVOKnjKkrJ0g-7Krqik0HymHekalSluGKdkyu-7Jk3eCZcs0SsYj_hz7FNyKmdmyAQ5XogJgaJXl6m3YUHb6UviK5TEmc[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "Content-Length: 0[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "Host: controller:5000[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "Connection: Keep-Alive[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "Accept-Encoding: gzip,deflate[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 >> "[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "HTTP/1.1 404 Not Found[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Date: Fri, 05 Oct 2018 14:32:42 GMT[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Vary: X-Auth-Token[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "x-openstack-request-id: req-ed449dbf-899a-4385-8db6-ace663d15421[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Content-Length: 247[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Keep-Alive: timeout=5, max=100[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Connection: Keep-Alive[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "Content-Type: application/json[\r][\n]" DEBUG [org.apache.http.wire] [main] http-outgoing-2 << "[\r][\n]" DEBUG [org.apache.http.headers] [main] http-outgoing-2 << HTTP/1.1 404 Not Found DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Date: Fri, 05 Oct 2018 14:32:42 GMT DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5 DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Vary: X-Auth-Token DEBUG [org.apache.http.headers] [main] http-outgoing-2 << x-openstack-request-id: req-ed449dbf-899a-4385-8db6-ace663d15421 DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Content-Length: 247 DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Keep-Alive: timeout=5, max=100 DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Connection: Keep-Alive DEBUG [org.apache.http.headers] [main] http-outgoing-2 << Content-Type: application/json DEBUG [org.apache.http.impl.execchain.MainClientExec] [main] Connection can be kept alive for 5000 MILLISECONDS DEBUG [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] [main] Connection [id: 2][route: {}->http://controller:5000] can be kept alive for 5.0 seconds DEBUG [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] [main] Connection released: [id: 2][route: {}->http://controller:5000][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20] Exception in thread "main" java.lang.NullPointerException at org.jboss.resteasy.util.ReadFromStream.readFromStream(ReadFromStream.java:30) at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.bufferEntity(ClientResponse.java:322) at org.openstack4j.connectors.resteasy.HttpResponseImpl.readEntity(HttpResponseImpl.java:117) at org.openstack4j.core.transport.functions.ResponseToActionResponse.apply(ResponseToActionResponse.java:31) at org.openstack4j.core.transport.functions.ResponseToActionResponse.apply(ResponseToActionResponse.java:22) at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:36) at org.openstack4j.connectors.resteasy.HttpResponseImpl.getEntity(HttpResponseImpl.java:64) at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:225) at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:207) at org.openstack4j.openstack.identity.v3.internal.RoleServiceImpl.checkProjectUserRole(RoleServiceImpl.java:53) at com.example.openstack.OpenStackIdentity.hasRoleInProject(OpenStackIdentity.java:277) at com.example.openstack.OpenstackApplication.main(OpenstackApplication.java:156)
I'm having the same problem...