NPE in zookeeperdiscoveryclient when instance-port not specified
See original GitHub issueI am seeing a strange NPE in ZKDC when the client is accessed first time to load the list of service instances:
java.lang.NullPointerException: null
at org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryClient.getInstances(ZookeeperDiscoveryClient.java:89)
It seems that under certain conditions, ZookeeperServiceDiscovery.build() is never called - and the bulk of init work is being done there. After adding the property spring.cloud.zookeeper.discovery.instance-port
the npe went away. The instance-port property is optional though, it should default to the listen port.
Note that the only other zookeeper related property i am using is spring.cloud.zookeeper.connect-string
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version 1.0.3, the only config property I had defined was the zookeeper connection string.
@spencergibb Thanks.I found out why it didn’t work in my project.I debugger and get the byte for path from curator client,the data:
then I tried to deserialize the data to ZookeeperInstance,the code
then I got the json string
then I found the ObejctMapper was from org.codehaus.jackson:jackson-mapper-asl:1.8.8.
I realized that it might be a dependency omit problem.I exclude the jackson from hadoop, then it work
It just was a bug in my code.Thank for your reply.