繁体   English   中英

使用 spf4j 时出现 NoSuchMethodError

[英]NoSuchMethodError when using spf4j

我正在尝试使用 spf4j https://github.com/zolyfarkas/spf4j

我用以下标签标记了我的方法:

@JmxExport
@PerformanceMonitor(warnThresholdMillis=1, errorThresholdMillis=100, recorderSource = RecorderSourceInstance.Rs5m.class)

我得到了例外:

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.spf4j.perf.aspects.PerformanceMonitorAspect.aspectOf()Lorg/spf4j/perf/aspects/PerformanceMonitorAspect;

我正在使用 JDK 1.7.0_55 -javaagent:depend/aspectj/1.8.6/lib/aspectjweaver-1.8.6.jar 和src/META-INF文件夹中的aop-ajc.xml从 Eclipse 启动应用程序

<?xml version="1.0" encoding="UTF-8"?>
<aspectj>
<aspects>
    <aspect name="org.spf4j.perf.aspects.PerformanceMonitorAspect" />
</aspects>
<weaver options="-verbose">
    <include within="com.*..*" />
</weaver>
</aspectj>

此外,此时 JMX Bean 在 VisualVM 中不可见。 我究竟做错了什么?

在此处也记录为问题: https : //github.com/zolyfarkas/spf4j/issues/4

当 PerformanceMonitorAspect 没有被 AspectJ 编织时会发生这种情况

添加包含 org..* 以进行编织,其中将包含 lib 方面修复了该问题。

<weaver options="-verbose -debug -showWeaveInfo">
    <include within="com.example..*" />
    <include within="org..*" />
</weaver>

欲了解更多详情,请参阅

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM