Skip to content
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

无法启动nacos 2.4.1,可以启动2.4.0 #12503

Closed
reigadegr opened this issue Aug 16, 2024 · 9 comments
Closed

无法启动nacos 2.4.1,可以启动2.4.0 #12503

reigadegr opened this issue Aug 16, 2024 · 9 comments

Comments

@reigadegr
Copy link

use cmdline: bin\startup.cmd -m standalone
启动2.4.0无任何问题,具体请看日志。err.log是启动时重定向出来的信息。
err.log
nacos.log

My env:

C:\Users\admxcy>java -version
java version "21.0.4" 2024-07-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.4+8.1 (build 21.0.4+8-LTS-jvmci-23.1-b41, mixed mode, sharing)

C:\Users\admxcy>mvn -version
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: D:\apache-maven
Java version: 21.0.4, vendor: Oracle Corporation, runtime: E:\Program\graalvm-jdk-21.0.4+8.1
Default locale: zh_CN, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
@xuxiaowei-com-cn
Copy link
Contributor

使用 JDK 8 呢?

可以看看这个:#12498

@reigadegr
Copy link
Author

通过#12498 这个issue的方法可以正常启动和使用。但是还有错误。

java.lang.reflect.InaccessibleObjectException: Unable to make field private volatile long java.util.concurrent.atomic.AtomicLong.value accessible: module java.base does not "opens java.util.concurrent.atomic" to unnamed module @246ae04d
        at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:177)
        at com.caucho.hessian.io.UnsafeDeserializer.getFieldMap(UnsafeDeserializer.java:328)
        at com.caucho.hessian.io.UnsafeDeserializer.<init>(UnsafeDeserializer.java:83)
        at com.caucho.hessian.io.SerializerFactory.getDefaultDeserializer(SerializerFactory.java:530)
        at com.caucho.hessian.io.SerializerFactory.loadDeserializer(SerializerFactory.java:487)
        at com.caucho.hessian.io.SerializerFactory.getDeserializer(SerializerFactory.java:426)
        at com.caucho.hessian.io.SerializerFactory.getDeserializer(SerializerFactory.java:706)
        at com.caucho.hessian.io.SerializerFactory.getObjectDeserializer(SerializerFactory.java:614)
        at com.caucho.hessian.io.SerializerFactory.getObjectDeserializer(SerializerFactory.java:591)
        at com.caucho.hessian.io.Hessian2Input.readObjectDefinition(Hessian2Input.java:2965)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2329)
        at com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417)
        at com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:238)
        at com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:149)
        at com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2998)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2922)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2895)
        at com.caucho.hessian.io.MapDeserializer.readMap(MapDeserializer.java:114)
        at com.caucho.hessian.io.SerializerFactory.readMap(SerializerFactory.java:556)
        at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2889)
        at com.alibaba.nacos.consistency.serialize.HessianSerializer.deseiralize0(HessianSerializer.java:78)
        at com.alibaba.nacos.consistency.serialize.HessianSerializer.deserialize(HessianSerializer.java:48)
        at com.alibaba.nacos.naming.core.v2.metadata.InstanceMetadataSnapshotOperation.loadSnapshot(InstanceMetadataSnapshotOperation.java:60)
        at com.alibaba.nacos.naming.core.v2.metadata.AbstractMetadataSnapshotOperation.readSnapshot(AbstractMetadataSnapshotOperation.java:71)
        at com.alibaba.nacos.naming.consistency.persistent.impl.AbstractSnapshotOperation.onSnapshotLoad(AbstractSnapshotOperation.java:70)
        at com.alibaba.nacos.core.distributed.raft.NacosStateMachine$1.onSnapshotLoad(NacosStateMachine.java:308)
        at com.alibaba.nacos.core.distributed.raft.NacosStateMachine.onSnapshotLoad(NacosStateMachine.java:172)
        at com.alipay.sofa.jraft.core.FSMCallerImpl.doSnapshotLoad(FSMCallerImpl.java:710)
        at com.alipay.sofa.jraft.core.FSMCallerImpl.runApplyTask(FSMCallerImpl.java:423)
        at com.alipay.sofa.jraft.core.FSMCallerImpl.access$100(FSMCallerImpl.java:73)
        at com.alipay.sofa.jraft.core.FSMCallerImpl$ApplyTaskHandler.onEvent(FSMCallerImpl.java:150)
        at com.alipay.sofa.jraft.core.FSMCallerImpl$ApplyTaskHandler.onEvent(FSMCallerImpl.java:142)
        at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:137)
        at java.base/java.lang.Thread.run(Thread.java:1583)

@KomachiSion
Copy link
Collaborator

看起来是hessain包冲突了,有自己该过代码吗

@KomachiSion
Copy link
Collaborator

Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.4.1
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 37832
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://127.0.0.1:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2024-08-19 09:58:14,130 WARN InetAddress.getLocalHost().getHostName() took 5002 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).

2024-08-19 09:58:19,133 WARN ManagementFactory.getRuntimeMXBean().getName() took 5003 milliseconds to respond. This may be due to slow host name resolution. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).

2024-08-19 09:58:20,638 INFO Tomcat initialized with port(s): 8848 (http)

2024-08-19 09:58:20,902 INFO Root WebApplicationContext: initialization completed in 1716 ms

2024-08-19 09:58:21,550 INFO Filter requestContextFilter was not registered (possibly already registered?)

2024-08-19 09:58:28,177 INFO Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@1756f7cc, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3138953b, org.springframework.security.web.context.SecurityContextPersistenceFilter@3eb3232b, org.springframework.security.web.header.HeaderWriterFilter@52a33c3f, org.springframework.security.web.csrf.CsrfFilter@688a2c09, org.springframework.security.web.authentication.logout.LogoutFilter@bc6288b, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@60bb7995, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@67774e29, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@27df95e, org.springframework.security.web.session.SessionManagementFilter@19a20bb2, org.springframework.security.web.access.ExceptionTranslationFilter@5b9499fe]

2024-08-19 09:58:28,362 INFO Adding welcome page: class path resource [static/index.html]

2024-08-19 09:58:28,580 INFO Exposing 1 endpoint(s) beneath base path '/actuator'

2024-08-19 09:58:28,589 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-08-19 09:58:28,589 INFO Will not secure Ant [pattern='/**']

2024-08-19 09:58:28,589 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-08-19 09:58:28,589 INFO Will not secure Mvc [pattern='/prometheus']

2024-08-19 09:58:28,589 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus/namespaceId/{namespaceId}']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-08-19 09:58:28,590 INFO Will not secure Mvc [pattern='/prometheus/namespaceId/{namespaceId}']

2024-08-19 09:58:28,590 WARN You are asking Spring Security to ignore Mvc [pattern='/prometheus/namespaceId/{namespaceId}/service/{service}']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.

2024-08-19 09:58:28,590 INFO Will not secure Mvc [pattern='/prometheus/namespaceId/{namespaceId}/service/{service}']

2024-08-19 09:58:28,626 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'

2024-08-19 09:58:28,633 INFO No TaskScheduler/ScheduledExecutorService bean found for scheduled processing

2024-08-19 09:58:28,643 INFO Nacos started successfully in stand alone mode. use embedded storage

我用官网的下载包启动,没有遇到这个问题。

@reigadegr
Copy link
Author

没改过他的代码,我也不会。你用的jdk是什么

@KomachiSion
Copy link
Collaborator

KomachiSion commented Aug 19, 2024

#12449

可能和这个pr有关, 之前有社区同学说sofa的hessain和caucho的hessain冲突,所以PR移除了对caucho 的 hessain的,转向统一使用sofa的hessain

sofa的hessain的概率是封装了一些caucho的hessain之后的打包,可能基础版本的caucho的hessain和之前使用的hessain版本不一致, 然后对jdk17+的支持有问题。

看下能否推动sofa-jraft解决这个问题, 如果不行的话, 下个版本回滚#12449 改动。

@reigadegr
Copy link
Author

感谢,那我先用240版本,期待新版

@wz826
Copy link

wz826 commented Aug 24, 2024

和hessian关系不大,主要是因为nacos配置为JDK1.8,而JDK17+开始使用按模块引入包语法,不兼容之前的语法,不过一定要运行的话可以加入以下命令:
文件:nacos/bin/startup.sh
JAVA_OPT="${JAVA_OPT} --add-opens java.base/java.lang=ALL-UNNAMED "

@KomachiSion
Copy link
Collaborator

Closed by #12565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants