gpt4 book ai didi

java - 无法公开 long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount()

转载 作者:行者123 更新时间:2023-11-30 01:51:20 24 4
gpt4 key购买 nike

我在 Java 11 的服务器日志中收到以下错误。有解决方案吗?

[2019-05-02 18:06:18 IST] [] ERROR com.codahale.metrics.ScheduledReporter [SID= UID= BGCD=] - Exception thrown from Slf4jReporter#report. Exception was suppressed.
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @489448ac
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
at deployment.myPage.war//com.codahale.metrics.jvm.FileDescriptorRatioGauge.invoke(FileDescriptorRatioGauge.java:48)
at deployment.myPage.war//com.codahale.metrics.jvm.FileDescriptorRatioGauge.getRatio(FileDescriptorRatioGauge.java:35)
at deployment.myPage.war//com.codahale.metrics.RatioGauge.getValue(RatioGauge.java:64)
at deployment.myPage.war//com.codahale.metrics.RatioGauge.getValue(RatioGauge.java:11)
at deployment.myPage.war//com.codahale.metrics.DerivativeGauge.getValue(DerivativeGauge.java:23)
at deployment.myPage.war//com.codahale.metrics.Slf4jReporter.logGauge(Slf4jReporter.java:306)
at deployment.myPage.war//com.codahale.metrics.Slf4jReporter.report(Slf4jReporter.java:220)
at deployment.myPage.war//com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:243)
at deployment.myPage.war//com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:182)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

最佳答案

您的项目的依赖项之一是尝试访问已移至内部 java 模块且不再公开的 jvm api。

使用以下标志运行应用程序应该可以解决问题:

--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED

关于java - 无法公开 long com.sun.management.internal.OperatingSystemImpl.getOpenFileDescriptorCount(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55952859/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com