【nacos】启动本地的nacos报错("instanceOperatorClientImpl")
OS:M1
Java:
openjdk version "1.8.0_322" OpenJDK Runtime Environment (Zulu 8.60.0.21-CA-macos-aarch64) (build 1.8.0_322-b06) OpenJDK 64-Bit Server VM (Zulu 8.60.0.21-CA-macos-aarch64) (build 25.322-b06, mixed mode)
启动命令:
startup.sh -m standalone
报错信息:
2022-08-01 19:26:23,472 INFO Reflections took 1 ms to scan 1 urls, producing 1 keys and 1 values 2022-08-01 19:26:24,032 WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '.' defined in URL [jar:file:/Users/zhugr/project/official/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.3.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:/Users/zhugr/project/official/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.3.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:/Users/zhugr/project/official/nacos/target/nacos-server.jar!/BOOT-INF/lib/nacos-naming-2.0.3.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.UnsatisfiedLinkError: /private/var/folders/2f/x8kl0p_s67x_bf_dmw_cr6c00000gn/T/librocksdbjni4090560663706445410.jnilib: dlopen(/private/var/folders/2f/x8kl0p_s67x_bf_dmw_cr6c00000gn/T/librocksdbjni4090560663706445410.jnilib, 1): no suitable image found. Did find: /private/var/folders/2f/x8kl0p_s67x_bf_dmw_cr6c00000gn/T/librocksdbjni4090560663706445410.jnilib: mach-o, but wrong architecture /private/var/folders/2f/x8kl0p_s67x_bf_dmw_cr6c00000gn/T/librocksdbjni4090560663706445410.jnilib: mach-o, but wrong architecture 2022-08-01 19:26:24,039 INFO Stopping service [Tomcat] 2022-08-01 19:26:24,041 WARN The web application [nacos] appears to have started a thread named [nacos.publisher-com.alibaba.nacos.common.event.ServerConfigChangeEvent] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2044) java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:403) com.alibaba.nacos.common.notify.DefaultPublisher.openEventHandler(DefaultPublisher.java:117) com.alibaba.nacos.common.notify.DefaultPublisher.run(DefaultPublisher.java:95) 2022-08-01 19:26:24,041 WARN The web application [nacos] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2083) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:750)
解决方案:
jdk版本有问题,更换jdk版本即可:全局配置的jdk版本是1.8_322,改为1.8_292,在启动的startup.sh里面配置
export JAVA_HOME="/Users/**/Library/Java/JavaVirtualMachines/adopt-openjdk-1.8.0_292/Contents/Home" #export JAVA_HOME export JAVA="$JAVA_HOME/bin/java" export BASE_DIR=`cd $(dirname $0)/..; pwd` export CUSTOM_SEARCH_LOCATIONS=file:${BASE_DIR}/conf/