Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-1404

Provenance Repository throws NPE on startup if it finds an empty Provenance Event file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.5.0
    • Core Framework
    • None

    Description

      We received the following stack trace from a user on the dev mailing list. It appears that if we have an empty provenance event file, we throw a NPE on startup. It looks like the initialize method parses each of the provenance log files and assumes at least one event to be present.

      2016-01-15 17:31:13,595 INFO [main] o.a.n.p.PersistentProvenanceRepository
      Created new Provenance Event Writers for events starting with ID 23842697
      2016-01-15 17:31:13,612 WARN [main] org.eclipse.jetty.webapp.WebAppContext
      Failed startup of context
      o.e.j.w.WebAppContext@5fa2d0d3

      {/nifi-api,file:/opt/nifi/0.4.1/work/jetty/ni fi-web-api-0.4.1.war/webapp/,STARTING}

      {./work/nar/framework/nifi-framework-
      nar-0.4.1.nar-unpacked/META-INF/bundled-dependencies/nifi-web-api-0.4.1.war
      }
      org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
      at
      org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.conte
      xtInitialized(ApplicationStartupContextListener.java:99) ~[na:na]
      at
      org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(Cont
      extHandler.java:800) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(Serv
      letContextHandler.java:444)
      ~[jetty-servlet-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler
      .java:791) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContext
      Handler.java:294) ~[jetty-servlet-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
      ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342
      ) ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java
      :741) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
      ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycl
      e.java:132) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCy
      cle.java:114) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.ja
      va:61) [jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycl
      e.java:132) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.eclipse.jetty.server.Server.start(Server.java:387)
      [jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCy
      cle.java:114) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.ja
      va:61) [jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.eclipse.jetty.server.Server.doStart(Server.java:354)
      [jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) [jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:663)
      [nifi-jetty-0.4.1.jar:0.4.1]
      at org.apache.nifi.NiFi.<init>(NiFi.java:137)
      [nifi-runtime-0.4.1.jar:0.4.1]
      at org.apache.nifi.NiFi.main(NiFi.java:227)
      [nifi-runtime-0.4.1.jar:0.4.1]
      Caused by: org.springframework.beans.factory.BeanCreationException: Error
      creating bean with name 'flowService': FactoryBean threw exception on
      object creation; nested exception is
      org.springframework.beans.factory.BeanCreationException: Error creating
      bean with name 'flowController': FactoryBean threw exception on object
      creation; nested exception is java.lang.RuntimeException: Unable to create
      Provenance Repository
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObj
      ectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForB
      eanInstance(AbstractBeanFactory.java:1517)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abs
      tractBeanFactory.java:314) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstr
      actBeanFactory.java:199) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.context.support.AbstractApplicationContext.getBean(Abst
      ractApplicationContext.java:962)
      ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.conte
      xtInitialized(ApplicationStartupContextListener.java:64) ~[na:na]
      ... 22 common frames omitted
      Caused by: org.springframework.beans.factory.BeanCreationException: Error
      creating bean with name 'flowController': FactoryBean threw exception on
      object creation; nested exception is java.lang.RuntimeException: Unable to
      create Provenance Repository
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObj
      ectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForB
      eanInstance(AbstractBeanFactory.java:1517)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abs
      tractBeanFactory.java:314) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstr
      actBeanFactory.java:199) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.context.support.AbstractApplicationContext.getBean(Abst
      ractApplicationContext.java:962)
      ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.apache.nifi.spring.StandardFlowServiceFactoryBean.getObject(StandardFlo
      wServiceFactoryBean.java:53) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 28 common frames omitted
      Caused by: java.lang.RuntimeException: Unable to create Provenance
      Repository
      at
      org.apache.nifi.controller.FlowController.<init>(FlowController.java:417)
      ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.apache.nifi.controller.FlowController.createStandaloneInstance(FlowCont
      roller.java:352) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.apache.nifi.spring.FlowControllerFactoryBean.getObject(FlowControllerFa
      ctoryBean.java:66) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 35 common frames omitted
      Caused by: java.lang.NullPointerException: null
      at
      org.apache.nifi.provenance.PersistentProvenanceRepository.determineFirstEve
      ntTimestamp(PersistentProvenanceRepository.java:1030) ~[na:na]
      at
      org.apache.nifi.provenance.PersistentProvenanceRepository.initialize(Persis
      tentProvenanceRepository.java:272) ~[na:na]
      at
      org.apache.nifi.controller.FlowController.<init>(FlowController.java:413)
      ~[nifi-framework-core-0.4.1.jar:0.4.1]
      ... 38 common frames omitted
      2016-01-15 17:31:13,845 INFO [main]
      o.e.jetty.server.handler.ContextHandler Started
      o.e.j.w.WebAppContext@3556f201

      {/nifi-content-viewer,file:/opt/nifi/0.4.1/wo rk/jetty/nifi-web-content-viewer-0.4.1.war/webapp/,AVAILABLE} {./work/nar/fr amework/nifi-framework-nar-0.4.1.nar-unpacked/META-INF/bundled-dependencies /nifi-web-content-viewer-0.4.1.war}

      2016-01-15 17:31:13,847 INFO [main]
      o.e.jetty.server.handler.ContextHandler Started
      o.e.j.s.h.ContextHandler@160c946f

      {/nifi-docs,null,AVAILABLE}

      2016-01-15 17:31:13,885 INFO [main]
      o.e.jetty.server.handler.ContextHandler Started
      o.e.j.w.WebAppContext@13e50eb8

      {/nifi-docs,file:/opt/nifi/0.4.1/work/jetty/n ifi-web-docs-0.4.1.war/webapp/,AVAILABLE} {./work/nar/framework/nifi-framewo rk-nar-0.4.1.nar-unpacked/META-INF/bundled-dependencies/nifi-web-docs-0.4.1 .war}

      2016-01-15 17:31:13,913 INFO [main]
      o.e.jetty.server.handler.ContextHandler Started
      o.e.j.w.WebAppContext@576b09e2

      {/,file:/opt/nifi/0.4.1/work/jetty/nifi-web-e rror-0.4.1.war/webapp/,AVAILABLE} {./work/nar/framework/nifi-framework-nar-0 .4.1.nar-unpacked/META-INF/bundled-dependencies/nifi-web-error-0.4.1.war}

      2016-01-15 17:31:13,932 INFO [main]
      org.eclipse.jetty.server.ServerConnector Started
      ServerConnector@fcc6032

      {HTTP/1.1} {i-c894e249.dev.aws.lifelock.ad:8080}

      2016-01-15 17:31:13,932 INFO [main] org.eclipse.jetty.server.Server
      Started @21374ms
      2016-01-15 17:31:13,939 WARN [main] org.apache.nifi.web.server.JettyServer
      Failed to start web server... shutting down.
      org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
      at
      org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.conte
      xtInitialized(ApplicationStartupContextListener.java:99) ~[na:na]
      at
      org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(Cont
      extHandler.java:800) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(Serv
      letContextHandler.java:444)
      ~[jetty-servlet-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler
      .java:791) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContext
      Handler.java:294) ~[jetty-servlet-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
      ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342
      ) ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java
      :741) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
      ~[jetty-webapp-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycl
      e.java:132) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCy
      cle.java:114) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.ja
      va:61) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycl
      e.java:132) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.eclipse.jetty.server.Server.start(Server.java:387)
      ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCy
      cle.java:114) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.ja
      va:61) ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.eclipse.jetty.server.Server.doStart(Server.java:354)
      ~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
      at
      org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.
      java:68) ~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
      at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:663)
      ~[nifi-jetty-0.4.1.jar:0.4.1]
      at org.apache.nifi.NiFi.<init>(NiFi.java:137)
      [nifi-runtime-0.4.1.jar:0.4.1]
      at org.apache.nifi.NiFi.main(NiFi.java:227)
      [nifi-runtime-0.4.1.jar:0.4.1]
      Caused by: org.springframework.beans.factory.BeanCreationException: Error
      creating bean with name 'flowService': FactoryBean threw exception on
      object creation; nested exception is
      org.springframework.beans.factory.BeanCreationException: Error creating
      bean with name 'flowController': FactoryBean threw exception on object
      creation; nested exception is java.lang.RuntimeException: Unable to create
      Provenance Repository
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObj
      ectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForB
      eanInstance(AbstractBeanFactory.java:1517)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abs
      tractBeanFactory.java:314) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstr
      actBeanFactory.java:199) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.context.support.AbstractApplicationContext.getBean(Abst
      ractApplicationContext.java:962)
      ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.conte
      xtInitialized(ApplicationStartupContextListener.java:64) ~[na:na]
      ... 22 common frames omitted
      Caused by: org.springframework.beans.factory.BeanCreationException: Error
      creating bean with name 'flowController': FactoryBean threw exception on
      object creation; nested exception is java.lang.RuntimeException: Unable to
      create Provenance Repository
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObj
      ectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForB
      eanInstance(AbstractBeanFactory.java:1517)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abs
      tractBeanFactory.java:314) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstr
      actBeanFactory.java:199) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.springframework.context.support.AbstractApplicationContext.getBean(Abst
      ractApplicationContext.java:962)
      ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at
      org.apache.nifi.spring.StandardFlowServiceFactoryBean.getObject(StandardFlo
      wServiceFactoryBean.java:53) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 28 common frames omitted
      Caused by: java.lang.RuntimeException: Unable to create Provenance
      Repository
      at
      org.apache.nifi.controller.FlowController.<init>(FlowController.java:417)
      ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.apache.nifi.controller.FlowController.createStandaloneInstance(FlowCont
      roller.java:352) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.apache.nifi.spring.FlowControllerFactoryBean.getObject(FlowControllerFa
      ctoryBean.java:66) ~[nifi-framework-core-0.4.1.jar:0.4.1]
      at
      org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetO
      bjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
      ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 35 common frames omitted
      Caused by: java.lang.NullPointerException: null
      at
      org.apache.nifi.provenance.PersistentProvenanceRepository.determineFirstEve
      ntTimestamp(PersistentProvenanceRepository.java:1030) ~[na:na]
      at
      org.apache.nifi.provenance.PersistentProvenanceRepository.initialize(Persis
      tentProvenanceRepository.java:272) ~[na:na]
      at
      org.apache.nifi.controller.FlowController.<init>(FlowController.java:413)
      ~[nifi-framework-core-0.4.1.jar:0.4.1]
      ... 38 common frames omitted
      2016-01-15 17:31:13,945 INFO [Thread-2] org.apache.nifi.NiFi Initiating
      shutdown of Jetty web server...

      Attachments

        Activity

          People

            markap14 Mark Payne
            markap14 Mark Payne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: