gpt4 book ai didi

java - GarbageCollectionNotificationInfo 使用 Wildfly 8 导致 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-11-30 06:54:46 29 4
gpt4 key购买 nike

我正在尝试使用 GarbageCollectionNotificationInfo 订阅 GC 通知。通知有效,但当我尝试在 Wildfly 8.2 中使用此机制时,我收到 java.lang.NoClassDefFoundError:

java.lang.NoClassDefFoundError: com/sun/management/GarbageCollectionNotificationInfo
2017-02-06 08:40:09,156 ERROR [stderr] (Service Thread) at com.vonage.metrics.GCNotificationListener.handleNotification(GCNotificationListener.java:28)
2017-02-06 08:40:09,156 ERROR [stderr] (Service Thread) at sun.management.NotificationEmitterSupport.sendNotification(NotificationEmitterSupport.java:156)
2017-02-06 08:40:09,157 ERROR [stderr] (Service Thread) at sun.management.GarbageCollectorImpl.createGCNotification(GarbageCollectorImpl.java:147)

我发现在某些情况下你需要在 Jboss/Wildfly 中包含依赖项:https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly

我需要以某种方式包含 com.sun.* 包吗?

最佳答案

我最近遇到了同样的问题,只是使用 WildFly 10.1.0.Final

解决方案是在 jboss-deployment-struction.xml 中使用类似的内容显式包含 com.sun.management 类:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<dependencies>
<system>
<paths>
<path name="com/sun/management"/>
</paths>
</system>
</dependencies>
</deployment>
</jboss-deployment-structure>

关于java - GarbageCollectionNotificationInfo 使用 Wildfly 8 导致 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42066835/

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