1 Reply Latest reply on Dec 10, 2013 10:21 PM by S K

    ActiveMQ resource adapter and AspectJ weaver - classloading issue

    Rastko Soskic Newbie

      Hi,
      I have JBoss 7.1.1 (Brontes) with EAR deployed which depends on deployed resource adapter for ActiveMQ (5.8).
      I've tried with EAP 6.1 (7.2.0) - behavior is the same.

       

      Now, in jboss-deployment-structure I declare dependency on resource adapter and export it as submodules of EAR need ActiveMQ classes.

       

      That worked quite ok so far.

       

      Now I added AspectJ libraries (runtime and weaver) and defined simple aspect.
      Here comes intersting part... after doing so EAR deployment fails with:

       

      Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
        at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.7.0_25]
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) [rt.jar:1.7.0_25]
        at java.lang.Class.getDeclaredMethods(Class.java:1845) [rt.jar:1.7.0_25]
        at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159)
        at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
        at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:257)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:227)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:623)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_25]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_25]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_25]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [rt.jar:1.7.0_25]
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
        ... 56 more
      Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException from [Module "deployment.activemq-rar.rar:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]
        ... 73 more
      

       

      Furthermore, as within EAR is contained simple Spring application, I need to point out that when run outside of JBoss container,
      application works quite ok with aspectj.

       

      Check out line 20 for message JBoss classloader displays...

      If I remove just aspect definition (not aspectj libraries from EAR) EAR deploys ok...

       

      Any tip/suggestion/info is welcome and appreciated. I didn't add actual code here as maybe someone faced with similar issue before
      or can think of what could be an issue. If it will help I can post code too.

       

      Thanks in advance.