Support Questions
Find answers, ask questions, and share your expertise

Nifi to Spark integration with Livy | knox authorization issue

Hi Team,

I have built a flow in nifi, where reading files from hdfs and we need to trigger spark job by passing these files. We are using Livy to trigger spark job and facing some issue while PostHTTPProcessor is triggering livy URL.

Below are some details.

1) PostHTTP, We give a URL to our Livy server

2)Passing parameters for filename as args

3)Passing spark-job jar as file: /jar/singledataplatform/sd-spark-1.0-SNAPSHOT.jar

4)Passing className: the fully qualified classname for sparkjob i.e. com.markit.sdp.spark.SparkApplication

We get 500 server error in the nifi-app.log as below

2017-10-12 10:45:57,733 ERROR [Timer-Driven Process Thread-7] o.a.nifi.processors.standard.PostHTTP PostHTTP[id=eba83476-015e-1000-7b4f-a5b82838282f] Failed to Post StandardFlowFileRecord[uuid=d86a6ff2-c8d5-4d53-af1d-2e7f6f7da000,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1507819557354-1156, container=default, section=132], offset=757275, length=197],offset=0,name=PV_170_Options_L1600_2017-10-04T131500-0400.txt.gz,size=197] to https://aw1frtdvhdp01.mdevlab.com:8443/gateway/default/livy/v1/batches: response code was 500:Server Error

On checking the livy logs we see below line.

"POST /batches?doAs=pv.hdp-user HTTP/1.1" 400 -

The knox, gateway.log are having exception as below.

2017-10-12 15:45:57,727 INFO hadoop.gateway (AclsAuthorizationFilter.java:doFilter(85)) - Access Granted: true 2017-10-12 15:45:57,732 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(69)) - Failed to execute filter: java.util.EmptyStackException 2017-10-12 15:45:57,733 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(66)) - Failed to execute filter: javax.servlet.ServletException: java.util.EmptyStackException 2017-10-12 15:45:57,733 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(66)) - Failed to execute filter: javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.util.EmptyStackException 2017-10-12 15:45:57,733 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(66)) - Failed to execute filter: javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.util.EmptyStackException 2017-10-12 15:45:57,733 ERROR hadoop.gateway (GatewayFilter.java:doFilter(145)) - Gateway processing failed: javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.util.EmptyStackException javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.util.EmptyStackException at org.apache.shiro.web.servlet.AdviceFilter.cleanup(AdviceFilter.java:196) at org.apache.shiro.web.filter.authc.AuthenticatingFilter.cleanup(AuthenticatingFilter.java:155) 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)