Ah ha! I figured it out. This is the same issue that is described in this old Shiro users thread: http://shiro-user.582556.n2.nabble.com/Shiro-quot-clearing-quot-POST-content-td7578961.html
The solution is to pass a valid Content-Type with the request. If I pass -H "Content-Type: application/json" with my curl command, it all works as expected. Glad to know this is not a bug in Zeppelin! ~ Jonathan On Mon, Jul 18, 2016 at 10:32 PM Jonathan Kelly <jonathaka...@gmail.com> wrote: > I should have mentioned the JIRA issue ID so that this issue might be more > searchable in the mailing list archives. Here it is: > https://issues.apache.org/jira/browse/ZEPPELIN-837 > > On Mon, Jul 18, 2016 at 10:29 PM Jonathan Kelly <jonathaka...@gmail.com> > wrote: > >> Through a handy dandy `git bisect` command, I found that the commit that >> caused this behavior is >> https://github.com/apache/zeppelin/commit/57555f5ba16dd8109942513181d1330e9958744e. >> Is this something that we might be able to get fixed before 0.6.1? Or am I >> simply doing something wrong now that Shiro security has been added? >> >> Thanks, >> Jonathan >> >> On Mon, Jul 18, 2016 at 2:34 PM Jonathan Kelly <jonathaka...@gmail.com> >> wrote: >> >>> I'm running into an issue with the REST API in Zeppelin 0.6.0 that I did >>> not experience using the same exact workflow on Zeppelin 0.5.6. >>> >>> When I call a method that takes a message body (i.e., POSTs and PUTs), I >>> get an NPE in the Zeppelin server. Somehow the message String being >>> passed to the API methods is always an empty string, causing GSON to >>> deserialize it into a null reference, ultimately resulting in an NPE soon >>> afterward. I have not yet figured out how and why the message is ending up >>> as an empty string but am looking into that now. >>> >>> I have reproduced this with both InterpreterRestApi.updateSetting() >>> (which uses a PUT) and NotebookRestApi.createNote() (which uses a POST). >>> >>> I am calling the API by writing a JSON object to a file, then passing it >>> to curl with -XPOST (or -XPUT) --data @file.json. e.g., >>> >>> % cat deps/settings.json >>> { >>> "dependencies": [ >>> { >>> "groupArtifactVersion": "/tmp/zeppelin/deps/commons-csv-1.1.jar", >>> "local": true >>> }, >>> { >>> "groupArtifactVersion": >>> "/tmp/zeppelin/deps/spark-csv_2.10-1.3.0.jar", >>> "local": true >>> } >>> ] >>> } >>> >>> % curl -s -XPUT --data @/tmp/zeppelin/deps/settings.json >>> http://localhost:8080/interpreter/setting/2BS95QDGK >>> >>> The resulting NPE (which I find in the Zeppelin server logs) looks like >>> the following: >>> >>> javax.servlet.ServletException: java.lang.RuntimeException: >>> org.apache.cxf.interceptor.Fault >>> at >>> org.apache.shiro.web.servlet.AdviceFilter.cleanup(AdviceFilter.java:196) >>> at >>> org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:148) >>> at >>> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) >>> at >>> org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) >>> at >>> org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) >>> at >>> org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) >>> at >>> org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) >>> at >>> org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) >>> at >>> org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) >>> at >>> org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) >>> at >>> org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) >>> at >>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) >>> at org.apache.zeppelin.server.CorsFilter.doFilter(CorsFilter.java:72) >>> at >>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) >>> at >>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) >>> at >>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) >>> at >>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) >>> at >>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) >>> at >>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) >>> at >>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) >>> at >>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) >>> at >>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) >>> at >>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) >>> at >>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) >>> at >>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) >>> at org.eclipse.jetty.server.Server.handle(Server.java:499) >>> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) >>> at >>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) >>> at >>> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) >>> at >>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) >>> at >>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) >>> at java.lang.Thread.run(Thread.java:745) >>> Caused by: java.lang.RuntimeException: org.apache.cxf.interceptor.Fault >>> at >>> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) >>> at >>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:333) >>> at >>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) >>> at >>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) >>> at >>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) >>> at >>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) >>> at >>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) >>> at >>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167) >>> at >>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) >>> at >>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:223) >>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:598) >>> at >>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) >>> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) >>> at >>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) >>> at >>> org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) >>> at >>> org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) >>> at >>> org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) >>> ... 30 more >>> Caused by: org.apache.cxf.interceptor.Fault >>> at >>> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) >>> at >>> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) >>> at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192) >>> at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100) >>> at >>> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57) >>> at >>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93) >>> at >>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) >>> ... 45 more >>> Caused by: java.lang.NullPointerException >>> at >>> org.apache.zeppelin.rest.InterpreterRestApi.updateSetting(InterpreterRestApi.java:132) >>> 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.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) >>> at >>> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) >>> ... 50 more >>> >>> Is anybody else able to reproduce this? >>> >>> If it matters, though I doubt that it does for this issue, I am setting >>> SPARK_HOME with a Scala 2.10-built version of Spark 1.6.2. >>> >>> Thank you, >>> Jonathan >>> >>