{"record":{"id":"15203a3f03e5bd91","repo":"alibaba/druid","slug":"please-set-the-zookeeper-node-path","errorCode":null,"errorMessage":"Please set the ZooKeeper node path.","messagePattern":"Please set the ZooKeeper node path\\.","errorType":"exception","errorClass":"DruidRuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/pool/ha/node/ZookeeperNodeListener.java","lineNumber":182,"sourceCode":"        lock.lock();\n        try {\n            Properties properties = getPropertiesFromCache();\n            List<NodeEvent> events = NodeEvent.getEventsByDiffProperties(getProperties(), properties);\n            if (events != null && !events.isEmpty()) {\n                setProperties(properties);\n            }\n            return events;\n        } finally {\n            lock.unlock();\n        }\n    }\n\n    private void checkParameters() {\n        if (client == null && StringUtils.isEmpty(zkConnectString)) {\n            throw new DruidRuntimeException(\"ZK Client is NULL, Please set the zkConnectString.\");\n        }\n        if (StringUtils.isEmpty(path)) {\n            throw new DruidRuntimeException(\"Please set the ZooKeeper node path.\");\n        }\n        if (StringUtils.isEmpty(urlTemplate)) {\n            throw new DruidRuntimeException(\"Please set the urlTemplate.\");\n        }\n    }\n\n    private void updateSingleNode(PathChildrenCacheEvent event, NodeEventTypeEnum type) {\n        ChildData data = event.getData();\n        String nodeName = getNodeName(data);\n        List<String> names = new ArrayList<String>();\n        names.add(getPrefix() + \".\" + nodeName);\n        Properties properties = getPropertiesFromChildData(data);\n        List<NodeEvent> events = NodeEvent.generateEvents(properties, names, type);\n\n        if (events.isEmpty()) {\n            return;\n        }\n        if (type == NodeEventTypeEnum.ADD) {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/pool/ha/node/ZookeeperNodeListener.java#L164-L200","documentation":"ZookeeperNodeListener.checkParameters() throws this when the ZooKeeper node path to watch is empty/null. The path is the znode whose children encode the HA node list (each child name -> host:port). Without it the PathChildrenCache and checkExists().forPath(path) calls have nothing to operate on, so Druid refuses to start the listener.","triggerScenarios":"Starting a ZookeeperNodeListener whose path field is null or empty string — i.e. setPath(...) was never called or was passed an empty value.","commonSituations":"Config typo (e.g. property named basePath vs path); environment-specific config not loaded; copying example code without substituting the real znode path.","solutions":["Call listener.setPath(\"/your/znode\") with the znode that contains one child per HA node.","Verify the znode exists in ZooKeeper (use zkCli `ls /your/znode`) and that the same path is configured.","Centralize HA config in one place to avoid divergent path values across environments."],"exampleFix":"// before\nZookeeperNodeListener l = new ZookeeperNodeListener();\nl.setZkConnectString(\"zk1:2181\");\nl.setUrlTemplate(\"jdbc:mysql://{host}:{port}/db\");\nl.start(); // throws: path missing\n\n// after\nl.setZkConnectString(\"zk1:2181\");\nl.setPath(\"/druid/ha/mysql\");\nl.setUrlTemplate(\"jdbc:mysql://{host}:{port}/db\");\nl.start();","handlingStrategy":"validation","validationCode":"ZookeeperNodeListener z = (ZookeeperNodeListener) listener;\nif (z.getPath() == null || z.getPath().isEmpty()) {\n    throw new IllegalStateException(\"set the ZooKeeper znode path via setPath(...)\");\n}","typeGuard":"public static boolean pathConfigured(ZookeeperNodeListener z) {\n    return z.getPath() != null && !z.getPath().isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Confirm the znode exists with `ls /your/path` in zkCli before starting the listener.","Use the exact property name Druid expects (path).","Centralize HA/ZK config to avoid divergent values across environments."],"tags":["ha-datasource","zookeeper","configuration","node-listener"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}