Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

i get this error when starting Nifi 1.9.2 in cluster mode with embedded zookeeper 3.5.5.

I successfully start three zookeeper 3.5.5 separately using Java 1.8.nifi.

org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
    at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:88)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:953)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:558)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:918)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:370)
    at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:848)
    at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:287)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:403)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
    at org.eclipse.jetty.server.Server.start(Server.java:419)
    at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
    at org.eclipse.jetty.server.Server.doStart(Server.java:386)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
    at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:935)
    at org.apache.nifi.NiFi.<init>(NiFi.java:158)
    at org.apache.nifi.NiFi.<init>(NiFi.java:72)
    at org.apache.nifi.NiFi.main(NiFi.java:297)
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.ArrayIndexOutOfBoundsException: 1
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
    at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:55)
    ... 38 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.ArrayIndexOutOfBoundsException: 1
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
    at org.apache.nifi.spring.StandardFlowServiceFactoryBean.getObject(StandardFlowServiceFactoryBean.java:48)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
    ... 44 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:188)
    at org.apache.nifi.controller.state.server.ZooKeeperStateServer.<init>(ZooKeeperStateServer.java:55)
    at org.apache.nifi.controller.state.server.ZooKeeperStateServer.create(ZooKeeperStateServer.java:189)
    at org.apache.nifi.controller.FlowController.<init>(FlowController.java:576)
    at org.apache.nifi.controller.FlowController.createClusteredInstance(FlowController.java:399)
    at org.apache.nifi.spring.FlowControllerFactoryBean.getObject(FlowControllerFactoryBean.java:65)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
    ... 51 common frames omitted
2019-08-03 11:13:17,902 INFO [Thread-1] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
2019-08-03 11:13:17,982 INFO [Thread-1] o.eclipse.jetty.server.AbstractConnector Stopped ServerConnector@1b07ba9{HTTP/1.1,[http/1.1]}{192.168.159.130:18001}
2019-08-03 11:13:17,991 INFO [Thread-1] org.eclipse.jetty.server.session node0 Stopped scavenging

This error took me too much time,but i could not reslove it. Can someone help me? THX in Advance.

conf/zookeeper.properties

clientPort=2187
#clientPort=2188
#clientPort=2189
server.1=machine001:3888:4888
server.2=machine001:5888:6888
server.3=machine001:7888:8888

conf/nifi.properties

nifi.state.management.embedded.zookeeper.start=true
nifi.web.http.host=machine001 
nifi.web.http.port=8000
#nifi.web.http.port=8001
#nifi.web.http.port=8002
nifi.cluster.is.node=true
nifi.cluster.node.address=machine001
nifi.cluster.node.protocol.port=9997
#nifi.cluster.node.protocol.port=9998
#nifi.cluster.node.protocol.port=9999
nifi.zookeeper.connect.string=machine001:2187,machine001:2188,machine001:2189

conf/state-management.xml

<property name="Connect String">machine001:2187,machine001:2188,machine001:2189</property>
                How a do you bind the clientport to the different machines. I just saw the default port over there. Did you set it for each instance?
– Manuel
                Aug 3, 2019 at 4:28
                Only one machaine but with different prots.[root@localhost bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /root/mycentos/zookeeper-1/bin/../conf/zoo.cfg Client port found: xxx1. Client address: localhost. Mode: follower #xxx2,#xxx3
– Cong
                Aug 3, 2019 at 5:40
                I checked the documentation of zookeeper as well. The configuration looks fine to me. Except it doesn't show all required properties ticktime and datadir. Does it start with default configuration or does it read the correct config file. Looks like that it ignores the server which are set in the config. I would guess it doesn't read the config file. Sorry when I'm guessing, but this is the tricky part.
– Manuel
                Aug 3, 2019 at 7:32
                You said you start zookeepers separately, but is there a reason to set the option nifi.state.management.embedded.zookeeper.start=true?
– Lamanus
                Aug 3, 2019 at 7:58
                hi,@Lamanus nifi.properties:# Specifies whether or not this instance of NiFi should run an embedded ZooKeeper server nifi.state.management.embedded.zookeeper.start=true # Properties file that provides the ZooKeeper properties to use if <nifi.state.management.embedded.zookeeper.start> is set to true nifi.state.management.embedded.zookeeper.properties=./conf/zookeeper.properties
– Cong
                Aug 3, 2019 at 9:15

The error is coming from ZooKeeper client code that parses the "server.XXX" entries in zookeeper.properts, and its trying to split the entry on ":" and get the parts at index 0 and index 1, and there is no index 1 so its getting array index out of bounds. This basically means one of your server entries is not of the form host:port or host:port:port.

Also, as mentioned in the comments, if you are setting nifi.state.management.embedded.zookeeper.start=true then you shouldn't be starting your own ZooKeeper. You either use embdedded or external, but not both.

Thank you for your answer sincerely.I sloved the problem because of your second part,but sometimes the third node can't connect.And i still wonder about your first part:which index are you indicating? ZooKeeper.properties: ` clientPort=2187server.1=machine001:3888:3888 server.2=machine001:5888:6888 server.3=machine001:7888:8888` – Cong Aug 6, 2019 at 2:43 So clientPort=2187 server.1=machine001:3888:3888 would be split in two parts by Zookeeper client code:server.1:machine001 and 3888:3888? And what does it meant there is no index 1?Please you explain more.Really appreciate! – Cong Aug 12, 2019 at 2:26

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.