0 Replies Latest reply on Feb 19, 2010 5:47 AM by Bala krishnan

    Using JBoss(4.2.0) with Spring and AspectJ

    Bala krishnan Newbie

      I have an application in which I'm trying to use AspectJ with Spring and deploy it in JBoss 4.2.0.


      AspectJ is integrated with spring and is loaded via


      <context:load-time-weaver />


      in spring xml file. When I run the application in standalone, it works fine -- aspects are getting called.


      However, when I deploy the application (as a war) in JBoss, aspects are not called. I think that the classes are also not weaved -- I've have enabled debug in aop.xml,



          <weaver options="-debug -verbose -showWeaveInfo">






      and logs(weaving related logs) are not printed when I run the application as war. However, I do get message that aop.xml files are loaded and aspects areregistered.


      What should I do to make aspects called in this environment? I tried disabling tomcat specific classloader (setting UseJBossWebLoader and Java2ClassLoadingCompliance to "true" in jboss-service.xml of tomcat, but that also didn't work. I have also given "-javaagent" to jboss startup.


      When I searched, one option given was to use application specific "context.xml" for tomcat and copy spring-tomcat-weaver.jar to tomcat classpath. However, I got a exception, saying logger class is available in two class hierarchies, when I tried this. Is this(having a context.xml) the correct way to solve the issue? How the whole thing will work if I have an EAR and a WAR inside that EAR (assuming that I want to weave classes inside and outside war)?