是否有可能在wicket 6上运行带有aspectJ的wicket-metrics?

时间:2016-05-25 14:18:41

标签: java maven wicket aspectj

我知道wicket-metrics是自Wicket 7.3.0以来的实验版本,但我正在开发一个基于Wicket 6.17.0的项目。 是否有人尝试使用wicket-metrics运行Wicket 6模块?

我尝试了什么:

  • 克隆了wicket git repo - https://github.com/apache/wicket并将wicket-metrics模块添加到我的项目中,指示pom.xml使用我项目中的依赖项。
  • aop.xml添加到我的META-INF文件夹,并在我的init()方法中启动JmxReporter。

但是我收到了无法注册WicketFilterInitAspect所需的错误(它包含在我的aop.xml文件中)。

META-INF文件夹中的aop.xml文件:

<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
    <!--<weaver options="-nowarn">-->
        <!--<include within="org.apache.wicket..*"/>-->
    <!--</weaver>-->
    <aspects>
        <!-- required -->
        <aspect name="org.apache.wicket.metrics.aspects.WicketFilterInitAspect" />
        <!-- optional -->
        <aspect name="org.apache.wicket.metrics.aspects.model.LoadableDetachableModelLoadAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerDetachAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.requesthandler.IRequestHandlerRespondAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.resource.IResourceCreateAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.behavior.BehaviorCreateAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentCreateAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnConfigureAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnDetachAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnInitializeAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentOnRenderAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.component.ComponentSetResponsePageAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAddAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerAppendJavaScriptAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.ajax.IPartialPageRequestHandlerPrependJavaScriptAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.resource.ResourceReferenceCreateAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.markup.WicketTagCreateAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.request.WicketFilterRequestCycleUrlAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.request.WicketFilterRequestCycleAspect" />
        <aspect name="org.apache.wicket.metrics.aspects.session.SessionCountListenerAspect" />
    </aspects>
</aspectj>

所以我的感觉是,这通常是可能的,我想知道是否有人曾经成功或有想法?

我的部分痕迹:

[NoCallStackClassLoader@290dbf45] info AspectJ Weaver Version 1.8.2 built on Thursday Aug 14, 2014 at 21:45:02 GMT
[NoCallStackClassLoader@290dbf45] info register classloader javax.management.remote.rmi.NoCallStackClassLoader@290dbf45
[NoCallStackClassLoader@290dbf45] info register aspect org.apache.wicket.metrics.aspects.WicketFilterInitAspect
May 26, 2016 8:23:02 PM org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: register definition failed
java.lang.RuntimeException: Cannot register non aspect: org$apache$wicket$metrics$aspects$WicketFilterInitAspect , org.apache.wicket.metrics.aspects.WicketFilterInitAspect
    at org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:219)
    at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:485)
    at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:304)
    at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:171)
    at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:339)
    at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:344)
    at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:318)
    at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:113)
    at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at javax.management.remote.rmi.NoCallStackClassLoader.findClass(NoCallStackClassLoader.java:126)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at javax.management.remote.rmi.RMIConnector$1.run(RMIConnector.java:2157)
    at javax.management.remote.rmi.RMIConnector$1.run(RMIConnector.java:2144)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.management.remote.rmi.RMIConnector.<clinit>(RMIConnector.java:2178)
    at javax.management.remote.rmi.RMIConnectorServer.objectToBind(RMIConnectorServer.java:752)
    at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:408)
    at sun.management.jmxremote.ConnectorBootstrap.exportMBeanServer(ConnectorBootstrap.java:768)
    at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:456)
    at sun.management.Agent.startAgent(Agent.java:257)
    at sun.management.Agent.startAgent(Agent.java:447)

我也得到了一些与spring框架相关的错误:

[AppClassLoader@14dad5dc] error can't determine superclass of missing type javax.cache.annotation.CacheResult
when weaving type org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[AppClassLoader@14dad5dc] error can't determine superclass of missing type javax.cache.annotation.CacheResult
when weaving type org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[AppClassLoader@14dad5dc] error can't determine whether missing type javax.cache.annotation.CacheResult is an instance of org.apache.wicket.Component
when weaving type org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[AppClassLoader@14dad5dc] error can't determine superclass of missing type javax.cache.annotation.CacheResult
when weaving type org.springframework.cache.jcache.interceptor.AnnotationJCacheOperationSource
when weaving classes 
when weaving 

1 个答案:

答案 0 :(得分:1)

请参阅AspectJ: ClassLoading issue when trying to use external aop.xml file

看起来很相关。

对不起,我帮不了多。