简体   繁体   中英

NoSuchMethodError when using spf4j

I'm trying to use spf4j https://github.com/zolyfarkas/spf4j

I've tagged my method with:

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

And I get exception on it:

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

I'm starting application From Eclipse with JDK 1.7.0_55 -javaagent:depend/aspectj/1.8.6/lib/aspectjweaver-1.8.6.jar and with aop-ajc.xml in src/META-INF folder

<?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>

Also JMX Beans are not visible in VisualVM at this point. What am I doing wrong?

Also logged as issue here: https://github.com/zolyfarkas/spf4j/issues/4

This happens when PerformanceMonitorAspect is not being weaved by AspectJ

adding to include org..* for weaving which will include the lib aspects fixes the issue.

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

For more detail see

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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