Georgi Ivanov created FALCON-1063:
-------------------------------------

             Summary: Falcon CLI list entities operation throws 
NullPointerException
                 Key: FALCON-1063
                 URL: https://issues.apache.org/jira/browse/FALCON-1063
             Project: Falcon
          Issue Type: Bug
          Components: client
    Affects Versions: 0.6, trunk
            Reporter: Georgi Ivanov


Using falcon v0.6 and doing list entities I receive NullPointerException. This 
happens only on falcon installations that had existing entities and got 
upgraded to 0.6. I run:

        falcon entity -type cluster -list
        falcon entity -type process -list

and I get this on console:

Stacktrace:
org.apache.falcon.client.FalconCLIException: Bad Request;null
        at 
org.apache.falcon.client.FalconCLIException.fromReponse(FalconCLIException.java:44)
        at 
org.apache.falcon.client.FalconClient.checkIfSuccessful(FalconClient.java:1172)
        at 
org.apache.falcon.client.FalconClient.sendListRequest(FalconClient.java:791)
        at 
org.apache.falcon.client.FalconClient.getEntityList(FalconClient.java:374)
        at org.apache.falcon.cli.FalconCLI.entityCommand(FalconCLI.java:412)
        at org.apache.falcon.cli.FalconCLI.run(FalconCLI.java:183)
        at org.apache.falcon.cli.FalconCLI.main(FalconCLI.java:133)


The stacktrace on the server shows:

        2015-03-03 04:14:06,462 ERROR - 
[683216314@qtp-1027439921-0:68e05a5c-95cb-46fb-a9f0-a7280e491dc2 
falcon:GET//entities/list/process] ~ Failed to get entity list 
(AbstractEntityManager:532)
java.lang.NullPointerException
        at 
org.apache.falcon.resource.AbstractEntityManager.tryProxy(AbstractEntityManager.java:353)
        at 
org.apache.falcon.resource.AbstractEntityManager.getEntities(AbstractEntityManager.java:583)
        at 
org.apache.falcon.resource.AbstractEntityManager.getEntityList(AbstractEntityManager.java:530)
        at 
org.apache.falcon.resource.proxy.SchedulableEntityManagerProxy.getEntityList(SchedulableEntityManagerProxy.java:405)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at 
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
        at 
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
        at 
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
        at 
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
        at 
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at 
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
        at 
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
        at 
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
        at 
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
        at 
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
        at 
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
        at 
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
        at 
org.apache.falcon.security.FalconAuthorizationFilter.doFilter(FalconAuthorizationFilter.java:102)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
        at 
org.apache.falcon.security.FalconAuthenticationFilter$2.doFilter(FalconAuthenticationFilter.java:184)
        at 
org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:572)
        at 
org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:542)
        at 
org.apache.falcon.security.FalconAuthenticationFilter.doFilter(FalconAuthenticationFilter.java:193)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
        at 
org.apache.falcon.security.FalconAuditFilter.doFilter(FalconAuditFilter.java:65)
        at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
        at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
        at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:767)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
        at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
        at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
        2015-03-03 04:14:06,463 ERROR - 
[683216314@qtp-1027439921-0:68e05a5c-95cb-46fb-a9f0-a7280e491dc2 
falcon:GET//entities/list/process] ~ Action failed: Bad Request
Error: null (FalconWebException:68)


This happened when upgrading falcon to 0.6. Cluster/process definitions do not 
contain ACLs. Looking at AbstractEntityManager.java source the problem is 
obvious:
                
                private void tryProxy(Entity entity) throws IOException, 
FalconException {
            final String aclOwner = entity.getACL().getOwner();
            final String aclGroup = entity.getACL().getGroup();

tryProxy method does not check if entity.getACL() returns null. There is a 
method called decorateEntityWithACL which is used as a kludge before invoking 
tryProxy method and it populates entities with some sample ACL and tryProxy 
does not throw null pointer exception. This is done in submitInternal() and 
update() methods in AbstractEntityManager.java, which are called when we call 
submit or update. However the list CLI operation calls getEntities() method, 
which calls tryProxy() but does not "decorate" the entity with 
decorateEntityWithACL() and hence we get NullPointerException. 

This bug affects falcon UI as well. I checked trunk and it is not fixed there 
as well. This bug won't manifest on entities created on falcon 0.6 because 
falcon "injects" ACLs into the entity definition before saving it to 
Configuration Store if it does not have one already.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to