问题描述:
启动nacos时,显示无法创建instanceOperatorClientImpl
部分错误代码展示:
2023-07-13 22:17:59,176 WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'instanceOperatorClientImpl' defined in URL
[jar:file:/D:/nacos-server-2.2.0/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.2.0.jar!/com/alibaba/nacos/naming/core/InstanceOperatorClientImpl.class]: Unsatisfied dependency expressed through constructor parameter 1;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clientOperationServiceProxy' defined in URL [
jar:file:/D:/nacos-server-2.2.0/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.2.0.jar!/com/alibaba/nacos/naming/core/v2/service/ClientOperationServiceProxy.class]: Unsatisfied dependency expressed through constructor parameter 1;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentClientOperationServiceImpl' defined in URL
[jar:file:/D:/nacos-server-2.2.0/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.2.0.jar!/com/alibaba/nacos/naming/core/v2/service/impl/PersistentClientOperationServiceImpl.class]:
Bean instantiation via constructor failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.nacos.naming.core.v2.service.impl.PersistentClientOperationServiceImpl]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
问题分析:
网上的解决方法有:检查数据库配置、检查nacos存放路径是否有中文等,我都试了,但是不能解决我的问题。最后发现是因为电脑上装了两个JDK版本,JDK8是用压缩包的方式安装,在环境变量中配的也是JDK8,JDK11是用exe文件安装的,没有配置环境变量。
解决方法:
把环境变量中配置的JDK版本换成JDK11的目录就可以了。