[ 
https://issues.apache.org/jira/browse/HBASE-22846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16916633#comment-16916633
 ] 

Wellington Chevreuil edited comment on HBASE-22846 at 8/27/19 1:09 PM:
-----------------------------------------------------------------------

So we do have UTs for this resource under 
*TestNamespacesInstanceResource.testNamespaceCreateAndDeletePBAndNoBody.* 
Noticed the same already tests condition of _no body_ POST requests, and these 
are always passing. Upon further investigation, I had found out this is due the 
http request content-type. The passing tests are properly setting it to 
"application/octet-stream". -Apparently, http clients such as curl default it 
to "text/html", if not explicitly set-. In this case, jersey is then directing 
the request to the wrong resource method, triggering the NPE. 


was (Author: wchevreuil):
So we do have UTs for this resource under 
*TestNamespacesInstanceResource.testNamespaceCreateAndDeletePBAndNoBody.* 
Noticed the same already tests condition of _no body_ POST requests, and these 
are always passing. Upon further investigation, I had found out this is due the 
http request content-type. The passing tests are properly setting it to 
"application/octet-stream". Apparently, http clients such as curl default it to 
"text/html", if not explicitly set. In this case, jersey is then directing the 
request to the wrong resource method, triggering the NPE. 

> Internal Error 500 when Using HBASE REST API to Create Namespace.
> -----------------------------------------------------------------
>
>                 Key: HBASE-22846
>                 URL: https://issues.apache.org/jira/browse/HBASE-22846
>             Project: HBase
>          Issue Type: Improvement
>          Components: hbase-connectors
>    Affects Versions: 2.1.1
>            Reporter: Sailesh Patel
>            Assignee: Wellington Chevreuil
>            Priority: Major
>
> When trying to the following URL to create namespace:
> Secured cluster: curl --negotiate -u : -i -k -vi -X POST 
> "http://HBASE_REST_API_HOST:20550/namespaces/datasparktest";
>  UnSecured cluster: curl -vi -X POST 
> "http://HBASE_REST_API_HOST:20550/namespaces/datasparktest";
> The following is returned on the console:
>  HTTP/1.1 500 Request failed.
> The Error in Hbase REST Server log is:
> 2019-08-13 15:44:55,080 WARN org.eclipse.jetty.servlet.ServletHandler: 
> javax.servlet.ServletException: java.lang.NullPointerException
>  at 
> org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489)
>  at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
> ...
> Caused by: java.lang.NullPointerException
>  at 
> org.apache.hadoop.hbase.rest.NamespacesInstanceResource.createOrUpdate(NamespacesInstanceResource.java:250)
>  at 
> org.apache.hadoop.hbase.rest.NamespacesInstanceResource.processUpdate(NamespacesInstanceResource.java:243)
>  at 
> org.apache.hadoop.hbase.rest.NamespacesInstanceResource.post(NamespacesInstanceResource.java:183)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498)
>  at 
> org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
>  at 
> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
>  at 
> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to