VMware Cloud Community
mwisner69
Contributor
Contributor

OpenAPIServlet HTTP 500 error just trying to login -- getting NullPointerException in java.net.URLDecoder.decode()

Hi,

I'm new to VMware APIs and vRealize Operations Manger 6.0     Please let me know if there is a more appropriate forum on which to post this question.

Following the directions returned by OpenAPIServlet, I'm trying to perform a simple login to vRealize Operations Manager 6.0 via RESTful calls using curl.  After obtaining a JSESSIONID and sending as a cookie, my HTTP POST fails with a HTTP 500.  Tracing out the exception from the stack trace (see below), the cause appears to be an attempt to URL decode a string that is null.  Maybe I am missing one or more required HTTP headers that is null and causing this problem?  I'm sending all the headers shown in the aforementioned directions, and have found very little-to-no info via Internet search.

Furthermore, using the same user/passwd manually in a browser, I can successfully login to vRealize Operations Manager so I know I have a valid, working account.  We are running vRealize Ops Mgr 6.0.

Anyone know what is causing the HTTP 500 or have any other input?

Thanks in advance,

Matt

--------------------------------

bash-4.1$ curl -v -k -X POST --cookie JSESSIONID=B1E7AF14AEB185F27F65102E6C3E6695  -u USER:PASS https://vropsmaster/HttpPostAdapter/OpenAPIServletIServlet

* About to connect() to vropsmaster port 443 (#0)

*   Trying 10.100.2.40... connected

* Connected to vropsmaster (10.100.2.40) port 443 (#0)

* Initializing NSS with certpath: sql:/etc/pki/nssdb

* warning: ignoring value of ssl.verifyhost

* skipping SSL peer certificate verification

* SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA

* Server certificate:

*       subject: OU=MBU,O="VMware, Inc.",CN=vc-ops-slice-1

*       start date: Jan 27 15:50:36 2015 GMT

*       expire date: Jan 27 15:50:36 2020 GMT

*       common name: vc-ops-slice-1

*       issuer: OU=MBU,O="VMware, Inc.",CN=vc-ops-cluster-ca_42527d3e-c46a-413a-8690-64d09c845286

* Server auth using Basic with user 'netcool'

> POST /HttpPostAdapter/OpenAPIServlet HTTP/1.1

> Authorization: Basic bmV0Y29vbDpNNHR0JGF1dDA=

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

> Host: vropsmaster

> Accept: */*

> Cookie: JSESSIONID=B1E7AF14AEB185F27F65102E6C3E6695

>

< HTTP/1.1 500 Internal Server Error

< Date: Fri, 06 Feb 2015 22:49:19 GMT

< Server: Apache

< Content-Language: en

< Content-Length: 1598

< Connection: close

< Content-Type: text/html;charset=utf-8

<

<html><head><title>VMware vFabric tc Runtime 2.9.5.SR1/7.0.50.C.RELEASE - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException

        java.net.URLDecoder.decode(Unknown Source)

        com.integrien.alive.openapi.httppost.OpenAPIServlet.doPost(OpenAPIServlet.java:401)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

        javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

* Closing connection #0

</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the VMware vFabric tc Runtime 2.9.5.SR1/7.0.50.C.RELEASE logs.</u></p><HR size="1" noshade="noshade"><h3>VMware vFabric tc Runtime 2.9.5.SR1/7.0.50.C.RELEASE</h3></body></html>-bash-4.1$

0 Kudos
2 Replies
nboshnakov
VMware Employee
VMware Employee

It seems like the problem here is that the POST request body is empty and therefore the url decored is throwing the NPE.

You should provide the body to curl with the --data flag, for example :

curl -k -v -X POST -u user:password --data "action=getResourceState&sourceAdapter=ADAPTER_NAME&resourceName=VM_NAME&resourceKindKey=VirtualMachine" https://<vcops-ip>:443/HttpPostAdapter/OpenAPIServlet

Otherwise, the authentication seems to be fine from what i can see in your log.

You can also try using the official REST API, which is easier to use and can be found here https://<vcops-ip>/suite-api.

In the documentation you can find the exact usage of the authentication API  (/api/auth/token/acquire) in order to perform some basic authentication.

mwisner69
Contributor
Contributor

Problem was the SSL certificate's hostname did not match the VROPS hostname and after I disabled the "host verification" got it working.  THanks for all your help!

0 Kudos