cuba-platform / cuba-zk

Application component for coordinating CUBA cluster using ZooKeeper
6 stars 1 forks source link

Web block does not start if middleware servers didn't connect to ZooKeeper before #1

Open knstvk opened 6 years ago

knstvk commented 6 years ago

Exception stack trace on start:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cuba_ServerSelector' defined in class path resource [com/haulmont/addon/zookeeper/web-spring.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Error reading servers list
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    ... 31 common frames omitted
Caused by: java.lang.RuntimeException: Error reading servers list
    at com.haulmont.addon.zookeeper.discovery.ZkServerSelector.initialDiscovery(ZkServerSelector.java:145) ~[cubazk-global-1.3.0.jar:na]
    at com.haulmont.addon.zookeeper.discovery.ZkServerSelector.init(ZkServerSelector.java:74) ~[cubazk-global-1.3.0.jar:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]
    ... 38 common frames omitted
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /cuba/servers
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.8.jar:3.4.8--1]
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.8.jar:3.4.8--1]
    at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1650) ~[zookeeper-3.4.8.jar:3.4.8--1]
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:230) ~[curator-framework-2.12.0.jar:na]
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:219) ~[curator-framework-2.12.0.jar:na]
    at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:109) ~[curator-client-2.12.0.jar:na]
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:216) ~[curator-framework-2.12.0.jar:na]
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:207) ~[curator-framework-2.12.0.jar:na]
    at org.apache.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:40) ~[curator-framework-2.12.0.jar:na]
    at com.haulmont.addon.zookeeper.discovery.ZkServerSelector.initialDiscovery(ZkServerSelector.java:135) ~[cubazk-global-1.3.0.jar:na]
    ... 46 common frames omitted
bekonti commented 2 years ago

I solve it like, installing kafka, ZooKeeper and start zookeeper server, then on my application.properties specified address of server where I ran, in my case it is localhost so I specify 127.0.0.1:2181 and my application is running. Now I got another ISSUE like how to use this add-on in my app, so could you give me an Examples please 😁 like how to set and get values from ZK server