6 Replies Latest reply on Sep 26, 2012 8:14 AM by Freeman(Yue) Fang

    Spring AOP, AspectJWeaver and Camel

    Lekan Omotayo Expert

      I am trying to implement some Aspect Oriented Programming on Camel with AspectJWeaver, but I kept getting :

       

      Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException not found by org.springframework.aop

       

      Apparently ,the SPring AOP cant see AspectJWeaver in classpath even though I have it installed and when I checked the header on karaf console, I could see that particular package being exported by aspectjweaver. I have gone through different recommendations from http://fusesource.com/issues/browse/ESB-793 to http://stackoverflow.com/questions/12077274/use-spring-aop-in-osgi-bundle.

        • 1. Re: Spring AOP, AspectJWeaver and Camel
          Freeman(Yue) Fang Master

          Hi,

           

          Spring AOP bundle import org.aspectj.weaver.reflect pacakge as optional.

          org.aspectj.weaver.reflect;resolution:=optional;version="[1.5.4, 2.0.0)",

           

          So after you installed AspectJWeaver bundle, you need refresh Spring AOP bundle to let Spring AOP pick up this optional import, then org.aspectj.weaver.reflect should be available for Spring AOP.

           

          Freeman

          • 2. Re: Spring AOP, AspectJWeaver and Camel
            Lekan Omotayo Expert

            I saw that recommendation earlier in the link I sent. I refreshed Spring AOP and even restarted the Fuse ESB service none resolved it.

             

            NB: We are running Apache-Servicemix-4.4.0-fuse-00-43.

            • 3. Re: Spring AOP, AspectJWeaver and Camel
              Freeman(Yue) Fang Master

              Hi,

               

              What's the version of the  AspectJWeaver bundle you installed?

               

              Could you please post the output of

              osgi:headers  AspectJWeaver_bundle_id

              ?

               

              Ensure it's version is in range [1.5.4, 2.0.0) so that spring aop bundle can pick it up.

               

              Freeman

              • 4. Re: Spring AOP, AspectJWeaver and Camel
                Lekan Omotayo Expert

                Following the posts in the servicemix forum, I installed aspectjtools and here are the exported packages:

                 

                 

                about_files,version=0.0.0

                ant_tasks,version=0.0.0

                org.aspectj,version=0.0.0

                org.aspectj.ajde,version=0.0.0

                org.aspectj.ajde.core,version=0.0.0

                org.aspectj.ajde.core.internal,version=0.0.0

                org.aspectj.ajde.internal,version=0.0.0

                org.aspectj.ajde.resources.actions,version=0.0.0

                org.aspectj.ajde.resources.structure,version=0.0.0

                org.aspectj.ajde.ui,version=0.0.0

                org.aspectj.ajde.ui.internal,version=0.0.0

                org.aspectj.ajde.ui.javaoptions,version=0.0.0

                org.aspectj.ajde.ui.swing,version=0.0.0

                org.aspectj.ajdt.ajc,version=0.0.0

                org.aspectj.ajdt.compiler,version=0.0.0

                org.aspectj.ajdt.core,version=0.0.0

                org.aspectj.ajdt.core.dom,version=0.0.0

                org.aspectj.ajdt.internal.compiler,version=0.0.0

                org.aspectj.ajdt.internal.compiler.ast,version=0.0.0

                org.aspectj.ajdt.internal.compiler.lookup,version=0.0.0

                org.aspectj.ajdt.internal.compiler.parser,version=0.0.0

                org.aspectj.ajdt.internal.compiler.problem,version=0.0.0

                org.aspectj.ajdt.internal.core.builder,version=0.0.0

                org.aspectj.apache.bcel,version=0.0.0

                org.aspectj.apache.bcel.classfile,version=0.0.0

                org.aspectj.apache.bcel.classfile.annotation,version=0.0.0

                org.aspectj.apache.bcel.generic,version=0.0.0

                org.aspectj.apache.bcel.util,version=0.0.0

                org.aspectj.asm,version=0.0.0

                org.aspectj.asm.internal,version=0.0.0

                org.aspectj.bridge,version=0.0.0

                org.aspectj.bridge.context,version=0.0.0

                org.aspectj.internal.lang.annotation,version=0.0.0

                org.aspectj.internal.lang.reflect,version=0.0.0

                org.aspectj.lang,version=0.0.0

                org.aspectj.lang.annotation,version=0.0.0

                org.aspectj.lang.internal.lang,version=0.0.0

                org.aspectj.lang.reflect,version=0.0.0

                org.aspectj.org.eclipse.jdt.core,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.compiler,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.dom,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.dom.rewrite,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.eval,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.formatter,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.jdom,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.search,version=0.0.0

                org.aspectj.org.eclipse.jdt.core.util,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.codeassist,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.codeassist.complete,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.codeassist.impl,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.codeassist.select,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.ast,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.batch,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.classfmt,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.codegen,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.env,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.flow,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.impl,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.lookup,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.parser,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.parser.diagnose,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.problem,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.compiler.util,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.builder,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.eval,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.hierarchy,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.index,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.jdom,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.search,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.search.indexing,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.search.matching,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.search.processing,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.core.util,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.eval,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.formatter,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.formatter.align,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.formatter.comment,version=0.0.0

                org.aspectj.org.eclipse.jdt.internal.formatter.old,version=0.0.0

                org.aspectj.runtime,version=0.0.0

                org.aspectj.runtime.internal,version=0.0.0

                org.aspectj.runtime.internal.cflowstack,version=0.0.0

                org.aspectj.runtime.reflect,version=0.0.0

                org.aspectj.tools.ajbrowser,version=0.0.0

                org.aspectj.tools.ajbrowser.core,version=0.0.0

                org.aspectj.tools.ajbrowser.ui,version=0.0.0

                org.aspectj.tools.ajbrowser.ui.swing,version=0.0.0

                org.aspectj.tools.ajc,version=0.0.0

                org.aspectj.tools.ajdoc,version=0.0.0

                org.aspectj.tools.ant.taskdefs,version=0.0.0

                org.aspectj.tools.ant.taskdefs.compilers,version=0.0.0

                org.aspectj.util,version=0.0.0

                org.aspectj.weaver,version=0.0.0

                org.aspectj.weaver.ast,version=0.0.0

                org.aspectj.weaver.bcel,version=0.0.0

                org.aspectj.weaver.bcel.asm,version=0.0.0

                org.aspectj.weaver.internal.tools,version=0.0.0

                org.aspectj.weaver.loadtime,version=0.0.0

                org.aspectj.weaver.loadtime.definition,version=0.0.0

                org.aspectj.weaver.ltw,version=0.0.0

                org.aspectj.weaver.patterns,version=0.0.0

                org.aspectj.weaver.reflect,version=0.0.0

                org.aspectj.weaver.tools,version=0.0.0

                org.eclipse.core.filesystem,version=0.0.0

                org.eclipse.core.filesystem.provider,version=0.0.0

                org.eclipse.core.internal.boot,version=0.0.0

                org.eclipse.core.internal.content,version=0.0.0

                org.eclipse.core.internal.dtree,version=0.0.0

                org.eclipse.core.internal.events,version=0.0.0

                org.eclipse.core.internal.filesystem,version=0.0.0

                org.eclipse.core.internal.filesystem.local,version=0.0.0

                org.eclipse.core.internal.jobs,version=0.0.0

                org.eclipse.core.internal.localstore,version=0.0.0

                org.eclipse.core.internal.preferences,version=0.0.0

                org.eclipse.core.internal.preferences.exchange,version=0.0.0

                org.eclipse.core.internal.preferences.legacy,version=0.0.0

                org.eclipse.core.internal.properties,version=0.0.0

                org.eclipse.core.internal.propertytester,version=0.0.0

                org.eclipse.core.internal.refresh,version=0.0.0

                org.eclipse.core.internal.registry,version=0.0.0

                org.eclipse.core.internal.registry.osgi,version=0.0.0

                org.eclipse.core.internal.registry.spi,version=0.0.0

                org.eclipse.core.internal.resources,version=0.0.0

                org.eclipse.core.internal.resources.mapping,version=0.0.0

                org.eclipse.core.internal.runtime,version=0.0.0

                org.eclipse.core.internal.utils,version=0.0.0

                org.eclipse.core.internal.watson,version=0.0.0

                org.eclipse.core.resources,version=0.0.0

                org.eclipse.core.resources.mapping,version=0.0.0

                org.eclipse.core.resources.refresh,version=0.0.0

                org.eclipse.core.resources.team,version=0.0.0

                org.eclipse.core.runtime,version=0.0.0

                org.eclipse.core.runtime.adaptor,version=0.0.0

                org.eclipse.core.runtime.content,version=0.0.0

                org.eclipse.core.runtime.dynamichelpers,version=0.0.0

                org.eclipse.core.runtime.internal.adaptor,version=0.0.0

                org.eclipse.core.runtime.internal.stats,version=0.0.0

                org.eclipse.core.runtime.jobs,version=0.0.0

                org.eclipse.core.runtime.preferences,version=0.0.0

                org.eclipse.core.runtime.spi,version=0.0.0

                org.eclipse.equinox.app,version=0.0.0

                org.eclipse.equinox.internal.app,version=0.0.0

                org.eclipse.text.edits,version=0.0.0

                org.eclipse.text.undo,version=0.0.0

                org.osgi.service.application,version=0.0.0

                org.osgi.service.condpermadmin,version=0.0.0

                org.osgi.service.permissionadmin,version=0.0.0

                org.osgi.service.prefs,version=0.0.0

                 

                 

                I installed the aspectjtools from mvnrepositories. Do you know where I can get a properly OSGi-fied aspectjtools bundle?

                 

                Regards.

                • 5. Re: Spring AOP, AspectJWeaver and Camel
                  Lekan Omotayo Expert

                  Thanks Freeman.

                   

                  I modified the Aspectjtool osgi bundle with eclipse plugin tool and I was able to get it fixed by modifying to this:

                   

                  org.aspectj.ajde,version=1.6.2

                  org.aspectj.ajde.core,version=1.6.2

                  org.aspectj.ajde.core.internal,version=1.6.2

                  org.aspectj.ajde.internal,version=1.6.2

                  org.aspectj.ajde.ui,version=1.6.2

                  org.aspectj.ajde.ui.internal,version=1.6.2

                  org.aspectj.ajde.ui.javaoptions,version=1.6.2

                  org.aspectj.ajde.ui.swing,version=1.6.2

                  org.aspectj.ajdt.ajc,version=1.6.2

                  org.aspectj.ajdt.compiler,version=1.6.2

                  org.aspectj.ajdt.core,version=1.6.2

                  org.aspectj.ajdt.core.dom,version=1.6.2

                  org.aspectj.ajdt.internal.compiler,version=1.6.2

                  org.aspectj.ajdt.internal.compiler.ast,version=1.6.2

                  org.aspectj.ajdt.internal.compiler.lookup,version=1.6.2

                  org.aspectj.ajdt.internal.compiler.parser,version=1.6.2

                  org.aspectj.ajdt.internal.compiler.problem,version=1.6.2

                  org.aspectj.ajdt.internal.core.builder,version=1.6.2

                  org.aspectj.apache.bcel,version=1.6.2

                  org.aspectj.apache.bcel.classfile,version=1.6.2

                  org.aspectj.apache.bcel.classfile.annotation,version=1.6.2

                  org.aspectj.apache.bcel.generic,version=1.6.2

                  org.aspectj.apache.bcel.util,version=1.6.2

                  org.aspectj.asm,version=1.6.2

                  org.aspectj.asm.internal,version=1.6.2

                  org.aspectj.bridge,version=1.6.2

                  org.aspectj.bridge.context,version=1.6.2

                  org.aspectj.internal.lang.annotation,version=1.6.2

                  org.aspectj.internal.lang.reflect,version=1.6.2

                  org.aspectj.lang,version=1.6.2

                  org.aspectj.lang.annotation,version=1.6.2

                  org.aspectj.lang.internal.lang,version=1.6.2

                  org.aspectj.lang.reflect,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.compiler,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.dom,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.dom.rewrite,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.eval,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.formatter,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.jdom,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.search,version=1.6.2

                  org.aspectj.org.eclipse.jdt.core.util,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.codeassist,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.codeassist.complete,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.codeassist.impl,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.codeassist.select,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.ast,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.batch,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.classfmt,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.codegen,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.env,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.flow,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.impl,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.lookup,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.parser,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.parser.diagnose,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.problem,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.compiler.util,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.builder,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.eval,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.hierarchy,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.index,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.jdom,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.search,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.search.indexing,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.search.matching,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.search.processing,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.core.util,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.eval,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.formatter,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.formatter.align,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.formatter.comment,version=1.6.2

                  org.aspectj.org.eclipse.jdt.internal.formatter.old,version=1.6.2

                  org.aspectj.runtime,version=1.6.2

                  org.aspectj.runtime.internal,version=1.6.2

                  org.aspectj.runtime.internal.cflowstack,version=1.6.2

                  org.aspectj.runtime.reflect,version=1.6.2

                  org.aspectj.tools.ajbrowser,version=1.6.2

                  org.aspectj.tools.ajbrowser.core,version=1.6.2

                  org.aspectj.tools.ajbrowser.ui,version=1.6.2

                  org.aspectj.tools.ajbrowser.ui.swing,version=1.6.2

                  org.aspectj.tools.ajc,version=1.6.2

                  org.aspectj.tools.ajdoc,version=1.6.2

                  org.aspectj.tools.ant.taskdefs,version=1.6.2

                  org.aspectj.tools.ant.taskdefs.compilers,version=1.6.2

                  org.aspectj.util,version=1.6.2

                  org.aspectj.weaver,version=1.6.2

                  org.aspectj.weaver.ast,version=1.6.2

                  org.aspectj.weaver.bcel,version=1.6.2

                  org.aspectj.weaver.bcel.asm,version=1.6.2

                  org.aspectj.weaver.internal.tools,version=1.6.2

                  org.aspectj.weaver.loadtime,version=1.6.2

                  org.aspectj.weaver.loadtime.definition,version=1.6.2

                  org.aspectj.weaver.ltw,version=1.6.2

                  org.aspectj.weaver.patterns,version=1.6.2

                  org.aspectj.weaver.reflect,version=1.6.2

                  org.aspectj.weaver.tools,version=1.6.2

                  org.eclipse.core.filesystem,version=1.6.2

                  org.eclipse.core.filesystem.provider,version=1.6.2

                  org.eclipse.core.internal.boot,version=1.6.2

                  org.eclipse.core.internal.content,version=1.6.2

                  org.eclipse.core.internal.dtree,version=1.6.2

                  org.eclipse.core.internal.events,version=1.6.2

                  org.eclipse.core.internal.filesystem,version=1.6.2

                  org.eclipse.core.internal.filesystem.local,version=1.6.2

                  org.eclipse.core.internal.jobs,version=1.6.2

                  org.eclipse.core.internal.localstore,version=1.6.2

                  org.eclipse.core.internal.preferences,version=1.6.2

                  org.eclipse.core.internal.preferences.exchange,version=1.6.2

                  org.eclipse.core.internal.preferences.legacy,version=1.6.2

                  org.eclipse.core.internal.properties,version=1.6.2

                  org.eclipse.core.internal.propertytester,version=1.6.2

                  org.eclipse.core.internal.refresh,version=1.6.2

                  org.eclipse.core.internal.registry,version=1.6.2

                  org.eclipse.core.internal.registry.osgi,version=1.6.2

                  org.eclipse.core.internal.registry.spi,version=1.6.2

                  org.eclipse.core.internal.resources,version=1.6.2

                  org.eclipse.core.internal.resources.mapping,version=1.6.2

                  org.eclipse.core.internal.runtime,version=1.6.2

                  org.eclipse.core.internal.utils,version=1.6.2

                  org.eclipse.core.internal.watson,version=1.6.2

                  org.eclipse.core.resources,version=1.6.2

                  org.eclipse.core.resources.mapping,version=1.6.2

                  org.eclipse.core.resources.refresh,version=1.6.2

                  org.eclipse.core.resources.team,version=1.6.2

                  org.eclipse.core.runtime,version=1.6.2

                  org.eclipse.core.runtime.adaptor,version=1.6.2

                  org.eclipse.core.runtime.content,version=1.6.2

                  org.eclipse.core.runtime.dynamichelpers,version=1.6.2

                  org.eclipse.core.runtime.internal.adaptor,version=1.6.2

                  org.eclipse.core.runtime.internal.stats,version=1.6.2

                  org.eclipse.core.runtime.jobs,version=1.6.2

                  org.eclipse.core.runtime.preferences,version=1.6.2

                  org.eclipse.core.runtime.spi,version=1.6.2

                  org.eclipse.equinox.app,version=1.6.2

                  org.eclipse.equinox.internal.app,version=1.6.2

                  org.eclipse.text.edits,version=1.6.2

                  org.eclipse.text.undo,version=1.6.2

                  org.osgi.service.application,version=1.6.2

                  org.osgi.service.condpermadmin,version=1.6.2

                  org.osgi.service.permissionadmin,version=1.6.2

                  org.osgi.service.prefs,version=1.6.2

                   

                  Thanks once again.

                  • 6. Re: Spring AOP, AspectJWeaver and Camel
                    Freeman(Yue) Fang Master

                    Hi,

                     

                    Thanks for this feed back, great to know it works for you.

                     

                    Freeman