-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException for ZookeeperAutoServiceRegistration #310
Labels
Comments
As workaround for fixing this: before calling For example:
Not so elegant solution, but it works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ZookeeperAutoServiceRegistration throws an exception when ServiceInstanceRegistration method getServiceInstance() is called before ZookeeperAutoServiceRegistration method getPort()
It happens because method
getServiceInstance()
callsbuild()
and whengetPort()
will be called it will return null instead 0.spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 64 to 69 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 71 to 73 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 83 to 88 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistration.java
Lines 70 to 79 in ec845a4
Also
getInstanceId()
method returns null.Use case when we need to call
getServiceInstance
for example to create leader candidate and associate with registration id for further understanding which node is a leader.The text was updated successfully, but these errors were encountered: