1 2 Previous Next 18 Replies Latest reply on Aug 4, 2009 11:20 PM by oren

    Spring AOP AspectJ ClassNotFound in an OSGi bundle

    oren

      Dear All,

       

      I have a bundle that uses  Exception in thread "SpringOsgiExtenderThread-98" org.springframe

      work.beans.factory.BeanCreationException: Error creating bean with name 'dtsOper

      ationService': BeanPostProcessor before instantiation of bean failed; nested exc

      eption is java.lang.NoClassDefFoundError: org/aspectj/lang/reflect/AjTypeSystem

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory$1.run(AbstractAutowireCapableBeanFactory.java:405)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      preInstantiateSingletons(DefaultListableBeanFactory.java:423)

              at org.springframework.context.support.AbstractApplicationContext.finish

      BeanFactoryInitialization(AbstractApplicationContext.java:728)

       

      Since that didn't work, I tried to embed the aspectj packages in the bundle. See the attached pom for the felix configuration.

       

      What am I doing wrong? How to solve it?

        • 1. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
          oren

          I've been trying several things to AOP-enable my bundle but none of them work. Same behavior in FUSE ESB 4.1.0.0 and 4.1.0.1:

          1) OSGify aspectjrt and aspjectweaver into a dedicated bundle that embeds and exports all org.aspectj packages. Include this bundle in my target bundle.

          2) Create an Osgi app context listener that creates my own Spring context and uses the classloader of the current thread or getBundleContext()'s classLoader. Then try to load an  org.springframework.beans.factory.parsing.BeanDefinitionParsingEx

          ception: Configuration problem: Unable to locate Spring NamespaceHandler for XML

          schema namespace http://www.springframework.org/schema/aop

          Offending resource: URL [bundle://156.0:1/META-INF/internal/fuse-aop-context-int

          ernal.xml]

           

                  at org.springframework.beans.factory.parsing.FailFastProblemReporter.err

          or(FailFastProblemReporter.java:68)

                  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC

          ontext.java:85)

                  at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC

          ontext.java:80)

                  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.er

          ror(BeanDefinitionParserDelegate.java:281)

                  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa

          rseCustomElement(BeanDefinitionParserDelegate.java:1294)

                  at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa

          rseCustomElement(BeanDefinitionParserDelegate.java:1287)

                  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe

          ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)

                  at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe

          ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe

          rBeanDefinitions(XmlBeanDefinitionReader.java:507)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB

          eanDefinitions(XmlBeanDefinitionReader.java:398)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea

          nDefinitions(XmlBeanDefinitionReader.java:342)

                  at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea

          nDefinitions(XmlBeanDefinitionReader.java:310)

                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

          r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

          r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

          r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

                  at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

          r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)

                  at org.springframework.context.support.AbstractXmlApplicationContext.loa

          dBeanDefinitions(AbstractXmlApplicationContext.java:113)

                  at org.springframework.context.support.AbstractXmlApplicationContext.loa

          dBeanDefinitions(AbstractXmlApplicationContext.java:80)

                  at org.springframework.context.support.AbstractRefreshableApplicationCon

          text.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

                  at org.springframework.context.support.AbstractApplicationContext.obtain

          FreshBeanFactory(AbstractApplicationContext.java:422)

                  at org.springframework.context.support.AbstractApplicationContext.refres

          h(AbstractApplicationContext.java:352)

                  at edu.utah.further.examples.fuse_aop.InternalApplicationContextCreatorL

          istener.initializeApplicationContext(InternalApplicationContextCreatorListener.j

          ava:223)

                  at edu.utah.further.examples.fuse_aop.InternalApplicationContextCreatorL

          istener.onOsgiApplicationEvent(InternalApplicationContextCreatorListener.java:14

          6)

                  at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

          sorImpl.java:25)

                  at java.lang.reflect.Method.invoke(Method.java:597)

                  at org.springframework.osgi.service.importer.support.internal.aop.Servic

          eInvoker.doInvoke(ServiceInvoker.java:64)

                  at org.springframework.osgi.service.importer.support.internal.aop.Servic

          eInvoker.invoke(ServiceInvoker.java:78)

                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

          ReflectiveMethodInvocation.java:171)

                  at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP

          roceed(DelegatingIntroductionInterceptor.java:131)

                  at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv

          oke(DelegatingIntroductionInterceptor.java:119)

                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

          ReflectiveMethodInvocation.java:171)

                  at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce

          ptor.invokeUnprivileged(ServiceTCCLInterceptor.java:57)

                  at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce

          ptor.invoke(ServiceTCCLInterceptor.java:40)

                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

          ReflectiveMethodInvocation.java:171)

                  at org.springframework.osgi.service.importer.support.LocalBundleContextA

          dvice.invoke(LocalBundleContextAdvice.java:59)

                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

          ReflectiveMethodInvocation.java:171)

                  at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP

          roceed(DelegatingIntroductionInterceptor.java:131)

                  at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv

          oke(DelegatingIntroductionInterceptor.java:119)

                  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

          ReflectiveMethodInvocation.java:171)

                  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

          cAopProxy.java:204)

                  at $Proxy3.onOsgiApplicationEvent(Unknown Source)

                  at org.springframework.osgi.extender.internal.activator.ListListenerAdap

          ter.onOsgiApplicationEvent(ListListenerAdapter.java:52)

                  at org.springframework.osgi.context.event.ApplicationListenerAdapter.onA

          pplicationEvent(ApplicationListenerAdapter.java:45)

                  at org.springframework.context.event.SimpleApplicationEventMulticaster$1

          .run(SimpleApplicationEventMulticaster.java:78)

                  at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecut

          or.java:49)

                  at org.springframework.context.event.SimpleApplicationEventMulticaster.m

          ulticastEvent(SimpleApplicationEventMulticaster.java:76)

                  at org.springframework.osgi.context.event.OsgiBundleApplicationContextEv

          entMulticasterAdapter.multicastEvent(OsgiBundleApplicationContextEventMulticaste

          rAdapter.java:63)

                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

          plicationContext.sendRefreshedEvent(AbstractDelegatedExecutionApplicationContext

          .java:601)

                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

          plicationContext.access$400(AbstractDelegatedExecutionApplicationContext.java:68

          )

                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

          plicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:349)

                  at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCus

          tomTCCL(PrivilegedUtils.java:85)

                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

          plicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja

          va:308)

                  at org.springframework.osgi.extender.internal.dependencies.startup.Depen

          dencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp

          plicationContextExecutor.java:138)

                  at java.lang.Thread.run(Thread.java:619)

           

          I tried to copy spring.schemas and spring.headers into my bundle's META-INF, but then I get an error that the root tag "beans" is not recognized.

          • 2. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
            rcracel

            Have you checked http://www.osgi.org/Repository/HomePage to see if there is already an OSGi-fied bundle available?

            • 3. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
              oren

              Yes, there is one:

              http://www.osgi.org/Repository/HomePage?cmd=inspect&id=com.springsource.org.aspectj.tools/1.6.4.RELEASE

               

              However, what should I do to use it? That's the missing part. Should I simply include it as a dependency of my bundle? Or do I also need to import any packages? Or something else?

              • 4. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                oren

                I installed the com.springsource aspecjrt and aspectjweaver OSGi jars (1.6.2.RELEASE) into FUSE. Unfortunately, I am still getting the same error when I start my bundle at the console by typing "update 155". I am attaching my pom and my Spring context file. When I started the bundle, it complains that it does not find aspectj classes:

                 

                08:09:46,271 | ERROR | xtenderThread-77 | WaiterApplicationContextExecutor | Wai

                terApplicationContextExecutor  398 | Unable to create application context for [e

                du.utah.further.examples.fuse-aop], unsatisfied dependencies: none

                org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected excep

                tion parsing XML document from URL [bundle://155.0:0/META-INF/spring/fuse-aop-co

                ntext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weav

                er/reflect/ReflectionWorld$ReflectionWorldException

                        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB

                eanDefinitions(XmlBeanDefinitionReader.java:420)

                        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea

                nDefinitions(XmlBeanDefinitionReader.java:342)

                        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBea

                nDefinitions(XmlBeanDefinitionReader.java:310)

                        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

                r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

                r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

                        at org.springframework.beans.factory.support.AbstractBeanDefinitionReade

                r.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

                        at org.springframework.osgi.context.support.OsgiBundleXmlApplicationCont

                ext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:176)

                        at org.springframework.osgi.context.support.OsgiBundleXmlApplicationCont

                ext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:142)

                        at org.springframework.context.support.AbstractRefreshableApplicationCon

                text.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

                        at org.springframework.context.support.AbstractApplicationContext.obtain

                FreshBeanFactory(AbstractApplicationContext.java:422)

                        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

                plicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:68

                )

                        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

                plicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:259)

                        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCus

                tomTCCL(PrivilegedUtils.java:85)

                        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

                plicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:

                237)

                        at org.springframework.osgi.extender.internal.dependencies.startup.Depen

                dencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContex

                tExecutor.java:215)

                        at org.springframework.osgi.extender.internal.dependencies.startup.Depen

                dencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContext

                Executor.java:168)

                        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

                plicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:179)

                        at org.springframework.osgi.extender.internal.activator.ContextLoaderLis

                tener$2.run(ContextLoaderListener.java:759)

                        at java.lang.Thread.run(Thread.java:619)

                Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/Reflection

                World$ReflectionWorldException

                        at java.lang.Class.forName0(Native Method)

                        at java.lang.Class.forName(Class.java:169)

                        at org.springframework.aop.config.ConfigBeanDefinitionParser.class$(Conf

                igBeanDefinitionParser.java:208)

                        at org.springframework.aop.config.ConfigBeanDefinitionParser.createPoint

                cutDefinition(ConfigBeanDefinitionParser.java:539)

                        at org.springframework.aop.config.ConfigBeanDefinitionParser.parsePointc

                ut(ConfigBeanDefinitionParser.java:476)

                        at org.springframework.aop.config.ConfigBeanDefinitionParser.parse(Confi

                gBeanDefinitionParser.java:142)

                        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(N

                amespaceHandlerSupport.java:69)

                        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa

                rseCustomElement(BeanDefinitionParserDelegate.java:1297)

                        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.pa

                rseCustomElement(BeanDefinitionParserDelegate.java:1287)

                        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe

                ader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)

                        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentRe

                ader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)

                        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registe

                rBeanDefinitions(XmlBeanDefinitionReader.java:507)

                        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadB

                eanDefinitions(XmlBeanDefinitionReader.java:398)

                        ... 18 more

                Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.Reflecti

                onWorld$ReflectionWorldException

                        at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourc

                eByDelegation(ModuleImpl.java:558)

                        at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleI

                mpl.java:59)

                        at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.

                loadClass(ModuleImpl.java:1427)

                        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

                        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                        ... 31 more

                 

                Does someone have a code of simple project they could share with me that shows how to use AOP inside a bundle on the FUSE ESB? Thanks.

                • 5. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                  mielket

                  Sorry oren, I also don't have a demo at hand here that shows how to use AOP in SMX 4.

                   

                  Can you attach a full testcase here that reproduces the error? I can install the AOP bundles from the OSGi repository but a testcase would be very helpful in analyzing this problem further.

                   

                  Thanks

                  • 6. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                    oren

                    Thanks for looking into this vital problem. Attached please find a zip containing my maven project. To reproduce the problem:

                    - Unzip the file into a folder "fuse-aop".

                    - cd fuse-aop

                    - mvn clean install

                    - On FUSE ESB 4.1.0.1, osgi/install -s mvn:edu.utah.further.examples/fuse-aop

                    - Look at the log file $FUSE_HOME/data/log/servicemix.log. It should contain the error above.

                     

                    Please kindly let me know if you can reproduce the problem and what you find. Thanks so much in advance!

                    • 7. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                      mielket

                      Sorry for the delay. I can reproduce your problem right now and am investigating.

                      • 8. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                        oren

                        Thank you so much, Torsten. Please let me know what you find.

                        • 9. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                          mielket

                          Quick update.

                          I took the latest FUSE ESB 4.1.0.2-fuse release, started it up (using JDK 1.6) and ran the following commands:

                           

                          smx@root:>osgi
                          smx@root:osgi>install http://repository.springsource.com/ivy/bundles/external/org.aspectj/com.springsource.org.aspectj.runtime/1.6.2.RELEASE/com.springsource.org.aspectj.runtime-1.6.2.RELEASE.jar
                          smx@root:osgi>install http://repository.springsource.com/ivy/bundles/external/org.aspectj/com.springsource.org.aspectj.weaver/1.6.2.RELEASE/com.springsource.org.aspectj.weaver-1.6.2.RELEASE.jar
                          smx@root:osgi>install mvn:edu.utah.further.examples/fuse-aop/0.0.1-SNAPSHOT
                          smx@root:osgi>start 156
                          smx@root:osgi>start 157
                          smx@root:osgi>start 158
                          

                           

                          And that gets me past the ClassNotFoundException. The bundle still does not start up fully as in my environment it still raises

                           

                          09:40:57,209 | ERROR | xtenderThread-70 | OsgiBundleXmlApplicationContext  | gatedExecutionApplicationContext  366 | Post refresh error
                          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleService' defined in URL [bundle://158.0:0/META-INF/sprin
                          g/fuse-aop-context.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce
                          ption: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org
                          .springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Construc
                          tor threw exception; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
                                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:405)
                                  at java.security.AccessController.doPrivileged(Native Method)
                                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
                                  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
                                  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
                                  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
                                  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
                                  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
                                  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
                                  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
                                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationCont
                          ext.java:68)
                                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.ja
                          va:343)
                                  at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
                                  at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplication
                          Context.java:308)
                                  at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(Dependen
                          cyWaiterApplicationContextExecutor.java:138)
                                  at java.lang.Thread.run(Thread.java:619)
                          

                           

                           

                          ... but that is a different problem and seems to be related to your AOP configuration. I am not an expert on Spring AOP, so wondering will you be able to process your testcase from here?

                           

                          In particular I did not install the AspectJ Tools bundle, which does not seem to be required and which somehow seems to be causing the ClassNotFoundException.

                           

                          Edited by: tmielke on Jul 21, 2009 7:50 AM

                           

                          Edited by: tmielke on Jul 21, 2009 8:18 AM

                          • 10. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                            mielket

                            I would like to raise another FUSE ESB bug regarding the NoClassDefFoundError and am wondering if I can attach your testcase to it? That bug report would be public (just as this forum) so I am just checking with you if we can use your testcase as a testcase for the bug to be raised?

                            • 11. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                              mielket

                              By the way, I also raised ESB-793 for this problem.

                              • 12. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                                oren

                                Thank you so much for working to resolve this! Yes, please go ahead and use the test case for the JIRA bug.

                                 

                                Unfortunately, I still didn't get it to work over here. Maybe I am missing something. Here is what I did:

                                • Downloaded fuse esb 4.1.0.2 on a Windows XP machine.

                                • Uncommented in etc/org.ops4j.pax.url.mvn.cfg the line to point to my local maven repository: org.ops4j.pax.url.mvn.localRepository=/web/repo

                                • Ran the following commands at the FUSE shell:

                                 

                                smx@root:osgi> install http://repository.springsource.com/ivy/bundles/external/o

                                rg.aspectj/com.springsource.org.aspectj.runtime/1.6.2.RELEASE/com.springsource.o

                                rg.aspectj.runtime-1.6.2.RELEASE.jar

                                Bundle ID: 156

                                smx@root:osgi> install http://repository.springsource.com/ivy/bundles/external/o

                                rg.aspectj/com.springsource.org.aspectj.weaver/1.6.2.RELEASE/com.springsource.or

                                g.aspectj.weaver-1.6.2.RELEASE.jar

                                Bundle ID: 157

                                smx@root:osgi> install mvn:edu.utah.further.examples/fuse-aop/0.0.1-SNAPSHOT

                                Bundle ID: 158

                                smx@root:osgi> start 156

                                smx@root:osgi> start 157

                                smx@root:osgi> start 158

                                smx@root:osgi> list

                                START LEVEL 100

                                   ID   State         Spring     Level  Name

                                System Bundle (1.5.0.r752991)

                                Apache Felix Prefrences Service (1.0.2)

                                Apache ServiceMix Bundles: jaxp-ri-1.4.2

                                (1.4.2.2)

                                Apache ServiceMix Specs :: JAXP API 1.4 (

                                1.3.0.fuse)

                                geronimo-annotation_1.0_spec (1.1.1)

                                OSGi R4 Compendium Bundle (4.1.0)

                                Apache Felix Configuration Admin Service

                                (1.0.4)

                                geronimo-servlet_2.5_spec (1.1.2)

                                Apache ServiceMix Kernel :: GShell Core (

                                1.1.0.fuse)

                                OPS4J Pax Logging - API (1.3.0)

                                OPS4J Pax Logging - Service (1.3.0)

                                OPS4J Pax Url - wrap: (0.3.3)

                                OPS4J Pax Url - mvn: (0.3.3)

                                Apache ServiceMix Kernel :: Management (1

                                .1.0.fuse)

                                spring-osgi-io (1.2.0.m2)

                                Apache ServiceMix Kernel :: GShell Admin

                                (1.1.0.fuse)

                                Apache ServiceMix Kernel :: JAAS Config (

                                1.1.0.fuse)

                                Apache ServiceMix Kernel :: GShell OSGi C

                                ommands (1.1.0.fuse)

                                Apache MINA Core (2.0.0.M6)

                                Apache ServiceMix Kernel :: GShell Config

                                Admin Commands (1.1.0.fuse)

                                Apache Mina SSHD :: Core (0.1.0)

                                Spring Context (2.5.6)

                                Apache ServiceMix Bundles: commons-jexl-1

                                .1 (1.1.0.1)

                                Apache ServiceMix Bundles: commons-httpcl

                                ient-3.1 (3.1.0.1)

                                Spring Core (2.5.6)

                                jmx-impl (1.0.0.r6125-patched)

                                Apache ServiceMix Kernel :: GShell Featur

                                es (1.1.0.fuse)

                                Apache ServiceMix Kernel :: GShell Log Co

                                mmands (1.1.0.fuse)

                                jmx (1.0.0.r6125-patched)

                                Apache ServiceMix Kernel :: GShell Packag

                                eAdmin Commands (1.1.0.fuse)

                                Apache ServiceMix Bundles: commons-vfs-1.

                                0 (1.0.0.1)

                                Spring Beans (2.5.6)

                                Apache ServiceMix Bundles: commons-codec-

                                1.2 (1.2.0.1)

                                spring-osgi-extender (1.2.0.m2)

                                Apache ServiceMix Bundles: jline-0.9.94 (

                                0.9.94.1)

                                Apache ServiceMix Bundles: aopalliance-1.

                                0 (1.0.0.1)

                                Apache ServiceMix Kernel :: JAAS Modules

                                (1.1.0.fuse)

                                Spring AOP (2.5.6)

                                Apache ServiceMix Bundles: oro-2.0.8 (2.0

                                .8.1)

                                Apache ServiceMix Kernel :: Spring Deploy

                                er (1.1.0.fuse)

                                spring-osgi-core (1.2.0.m2)

                                Apache ServiceMix Bundles: cglib-2.1_3 (2

                                .1.0.3_2)

                                Apache ServiceMix Kernel :: File Monitor

                                (1.1.0.fuse)

                                geronimo-jta_1.1_spec (1.1.1)

                                geronimo-j2ee-connector_1.5_spec (2.0.0)

                                Apache ServiceMix Bundles: howl-1.0.1-1 (

                                1.0.1.1_1)

                                Geronimo TxManager :: Transaction (2.2.0.

                                r634076)

                                activemq-broker.xml (0.0.0)

                                Spring Transaction (2.5.6)

                                Apache ServiceMix Transaction (1.1.0.fuse

                                )

                                Geronimo TxManager :: Connector (2.2.0.r6

                                34076)

                                geronimo-jms_1.1_spec (1.1.1)

                                Apache ServiceMix Bundles: jencks-2.1 (2.

                                1.0.1)

                                geronimo-j2ee-management_1.1_spec (1.0.1)

                                 

                                Apache Commons Pool Bundle (1.4)

                                xbean-spring (3.5)

                                kahadb (5.3.0.fuse)

                                activemq-core (5.3.0.fuse)

                                activemq-ra (5.3.0.fuse)

                                activemq-console (5.3.0.fuse)

                                activemq-pool (5.3.0.fuse)

                                Apache ServiceMix Features :: ActiveMQ Co

                                mmands (4.1.0.fuse)

                                Apache ServiceMix Specs :: STAX API 1.0 (

                                1.3.0.fuse)

                                Apache ServiceMix Specs :: ACTIVATION API

                                1.4 (1.3.0.fuse)

                                Apache ServiceMix Specs :: JAXB API 2.1 (

                                1.3.0.fuse)

                                Apache ServiceMix Bundles: jaxb-impl-2.1.

                                6 (2.1.6.1)

                                camel-core (1.6.1.fuse)

                                camel-osgi (1.6.1.fuse)

                                camel-spring (1.6.1.fuse)

                                xbean-naming (3.5)

                                Apache ServiceMix Naming (1.1.0.fuse)

                                Apache ServiceMix Specs :: JBI API 1.0 (1

                                .3.0.fuse)

                                Apache ServiceMix :: Utils (1.1.0.fuse)

                                Apache ServiceMix Document (1.1.0.fuse)

                                Apache ServiceMix NMR API (1.1.0.fuse)

                                Apache ServiceMix NMR Core (1.1.0.fuse)

                                Apache ServiceMix NMR OSGi (1.1.0.fuse)

                                Apache ServiceMix NMR Spring (1.1.0.fuse)

                                 

                                Apache ServiceMix NMR Commands (1.1.0.fus

                                e)

                                Apache ServiceMix NMR Management (1.1.0.f

                                use)

                                Apache ServiceMix Specs :: JAVAMAIL API 1

                                .4 (1.3.0.fuse)

                                xbean-classloader (3.5)

                                Apache ServiceMix Bundles: woodstox-3.2.7

                                (3.2.7.1)

                                Apache ServiceMix Bundles: wsdl4j-1.6.1 (

                                1.6.1.1)

                                Apache ServiceMix Bundles: ant-1.7.0 (1.7

                                .0.1)

                                Apache ServiceMix JBI Runtime (1.1.0.fuse

                                )

                                Apache ServiceMix JBI OSGi (1.1.0.fuse)

                                Apache ServiceMix JBI Deployer (1.1.0.fus

                                e)

                                Apache ServiceMix JBI Commands (1.1.0.fus

                                e)

                                Spring JMS (2.5.6)

                                Apache ServiceMix JBI Clustering Requesto

                                r (1.1.0.fuse)

                                Apache ServiceMix JBI Clustering Engine (

                                1.1.0.fuse)

                                Apache ServiceMix JBI Clustering Config (

                                1.1.0.fuse)

                                Apache ServiceMix Bundles: jetty-6.1.14 (

                                6.1.14.1)

                                OPS4J Pax Web - Jsp Support (0.5.2)

                                OPS4J Pax Web - Web Container (0.5.2)

                                OPS4J Pax Web Extender - WAR (0.5.0)

                                OPS4J Pax Web Extender - Whiteboard (0.5.

                                0)

                                OPS4J Pax Url - war:, war-i: (0.3.3)

                                Apache ServiceMix WAR Deployer (4.1.0.fus

                                e)

                                ServiceMix :: Common (2009.01.0.fuse)

                                geronimo-ws-metadata_2.0_spec (1.1.2)

                                Apache ServiceMix Specs :: SAAJ API 1.3 (

                                1.3.0.fuse)

                                Apache ServiceMix Specs :: JAXWS API 2.1

                                (1.3.0.fuse)

                                Apache ServiceMix Bundles: asm-2.2.3 (2.2

                                .3.1)

                                Apache ServiceMix Bundles: FastInfoset-1.

                                2.2 (1.2.2.1)

                                Apache ServiceMix Bundles: neethi-2.0.4 (

                                2.0.4.1)

                                Apache ServiceMix Bundles: saaj-impl-1.3

                                (1.3.0.1)

                                Apache ServiceMix Bundles: xmlschema-1.4.

                                3 (1.4.3.1)

                                Apache ServiceMix Bundles: xmlresolver-1.

                                2 (1.2.0.1)

                                Apache ServiceMix Bundles: xmlsec-1.3.0 (

                                1.3.0.1)

                                Apache ServiceMix Bundles: wss4j-1.5.4 (1

                                .5.4.1)

                                Apache ServiceMix Specs :: JSR311 API 1.0

                                (1.3.0.fuse)

                                Apache ServiceMix Bundles: xmlbeans-2.4.0

                                (2.4.0.2)

                                Apache CXF Bundle Jar (2.2.2.1-fuse)

                                ServiceMix :: SOAP2 (2009.01.0.fuse)

                                ServiceMix :: CXF Binding Component (2009

                                .01.0.fuse)

                                ServiceMix :: File (2009.01.0.fuse)

                                Apache ServiceMix Bundles: commons-net-1.

                                4.1 (1.4.1.1)

                                ServiceMix :: FTP (2009.01.0.fuse)

                                ServiceMix :: SOAP (2009.01.0.fuse)

                                ServiceMix :: HTTP (2009.01.0.fuse)

                                ServiceMix :: JMS (2009.01.0.fuse)

                                Apache ServiceMix Bundles: geronimo-javam

                                ail_1.4_provider-1.8-r755222 (1.8.0.r755222_1)

                                ServiceMix :: Mail (2009.01.0.fuse)

                                ServiceMix :: Bean (2009.01.0.fuse)

                                ServiceMix :: Camel (2009.01.0.fuse)

                                Apache CXF Runtime JBI Binding (2.2.2.1-f

                                use)

                                Apache CXF Runtime JBI Transport (2.2.2.1

                                -fuse)

                                ServiceMix :: CXF Service Engine (2009.01

                                .0.fuse)

                                Apache ServiceMix Bundles: core-3.2.3.v_6

                                86_R32x (3.2.3.1)

                                Apache ServiceMix Bundles: antlr-runtime-

                                3.0.1 (3.0.1.1)

                                Apache ServiceMix Bundles: drools-4.0.7 (

                                4.0.7.1)

                                ServiceMix :: Drools Service Engine (2009

                                .01.0.fuse)

                                ServiceMix :: EIP (2009.01.0.fuse)

                                Apache ServiceMix Bundles: antlr-3.0.1 (3

                                .0.1.1)

                                Commons Collections (3.2.1)

                                Apache ServiceMix Bundles: quartz-1.6.1 (

                                1.6.1.1)

                                Apache ServiceMix Bundles: oscore-2.2.4 (

                                2.2.4.1)

                                Apache ServiceMix Bundles: propertyset-1.

                                3 (1.3.0.1)

                                Apache ServiceMix Bundles: osworkflow-2.7

                                .0 (2.7.0.1)

                                ServiceMix :: OSWorkflow (2009.01.0.fuse)

                                 

                                Spring Context Support (2.5.6)

                                ServiceMix :: Quartz (2009.01.0.fuse)

                                Apache ServiceMix Specs :: Scripting API

                                1.0 (1.3.0.fuse)

                                Apache ServiceMix Bundles: groovy-1.5.6 (

                                1.5.6.1)

                                Apache ServiceMix Bundles: js-1.7R1 (1.0.

                                0.7R1_1)

                                Apache ServiceMix Bundles: jruby-1.1.2 (1

                                .1.2.1)

                                ScriptEngines :: Groovy (1.1)

                                ScriptEngines :: JavaScript (1.1)

                                ScriptEngines :: JRuby (1.1)

                                ServiceMix :: JSR-223 Scripting Service E

                                ngine (2009.01.0.fuse)

                                ServiceMix :: Validation (2009.01.0.fuse)

                                 

                                Apache ServiceMix Bundles: saxon-9.1.0.1

                                (9.1.0.1_1)

                                ServiceMix :: Saxon Service Engine (2009.

                                01.0.fuse)

                                ServiceMix :: WS-Notification Service Eng

                                ine (2009.01.0.fuse)

                                AspectJ Runtime (1.6.2.RELEASE)

                                AspectJ Weaver (1.6.2.RELEASE)

                                further-fuse-aop (0.0.1.SNAPSHOT)

                                smx@root:osgi>

                                 

                                • tail data/log/servicemix.log:

                                 

                                12:56:40,524 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl   64 | Executing (String): start 156

                                12:56:40,524 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl  104 | Executing (start):

                                12:56:41,774 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl   64 | Executing (String): start 157

                                12:56:41,774 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl  104 | Executing (start):

                                12:56:42,446 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl   64 | Executing (String): start 158

                                12:56:42,446 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl  104 | Executing (start):

                                12:56:42,446 | INFO  | localShell       | ultOsgiApplicationContextCreator | ultOsgiApplicationContextCreator   67 | Discovered configurations in bundle

                                12:56:42,446 | INFO  | xtenderThread-67 | OsgiBundleXmlApplicationContext  | pport.AbstractApplicationContext  411 | Refreshing org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext@1e9e78a: display name OsgiBundleXmlApplicationContext(bundle=edu.utah.further.examples.fuse-aop, config=osgibundle:/META-INF/spring/*.xml); startup date ; root of context hierarchy

                                12:56:42,446 | INFO  | xtenderThread-67 | XmlBeanDefinitionReader          | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from URL bundle://158.0:0/META-INF/spring/fuse-aop-context-osgi.xml

                                12:56:42,477 | INFO  | xtenderThread-67 | XmlBeanDefinitionReader          | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from URL bundle://158.0:0/META-INF/spring/fuse-aop-context.xml

                                12:56:42,508 | ERROR | xtenderThread-67 | OsgiBundleXmlApplicationContext  | gatedExecutionApplicationContext  293 | Pre refresh error

                                org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL bundle://158.0:0/META-INF/spring/fuse-aop-context.xml; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

                                     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:176)

                                     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:142)

                                     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

                                     at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:68)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:259)

                                     at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:237)

                                     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:215)

                                     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:168)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:179)

                                     at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:759)

                                     at java.lang.Thread.run(Thread.java:619)

                                Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

                                     at java.lang.Class.forName0(Native Method)

                                     at java.lang.Class.forName(Class.java:169)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.class$(ConfigBeanDefinitionParser.java:208)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.createPointcutDefinition(ConfigBeanDefinitionParser.java:539)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.parsePointcut(ConfigBeanDefinitionParser.java:476)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.parse(ConfigBeanDefinitionParser.java:142)

                                     at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)

                                     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)

                                     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)

                                     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)

                                     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)

                                     ... 18 more

                                Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:558)

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1427)

                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

                                     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                                     ... 31 more

                                12:56:42,508 | ERROR | xtenderThread-67 | WaiterApplicationContextExecutor | WaiterApplicationContextExecutor  398 | Unable to create application context for , unsatisfied dependencies: none

                                org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL bundle://158.0:0/META-INF/spring/fuse-aop-context.xml; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

                                     at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

                                     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:176)

                                     at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:142)

                                     at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

                                     at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:68)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:259)

                                     at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:237)

                                     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:215)

                                     at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:168)

                                     at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:179)

                                     at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:759)

                                     at java.lang.Thread.run(Thread.java:619)

                                Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

                                     at java.lang.Class.forName0(Native Method)

                                     at java.lang.Class.forName(Class.java:169)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.class$(ConfigBeanDefinitionParser.java:208)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.createPointcutDefinition(ConfigBeanDefinitionParser.java:539)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.parsePointcut(ConfigBeanDefinitionParser.java:476)

                                     at org.springframework.aop.config.ConfigBeanDefinitionParser.parse(ConfigBeanDefinitionParser.java:142)

                                     at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)

                                     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)

                                     at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)

                                     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)

                                     at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)

                                     at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)

                                     ... 18 more

                                Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:558)

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)

                                     at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1427)

                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

                                     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                                     ... 31 more

                                12:56:43,696 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl   64 | Executing (String): list

                                12:56:43,696 | INFO  | localShell       | CommandLineExecutorImpl          | om.shell.CommandLineExecutorImpl  104 | Executing (list): []

                                 

                                You mentioned that the AspectJ Tools bundle should not be installed, I don't think it is in the list above. However, I still get the NoClassDefFoundError error. I think I have the identical code to what I sent you; sending the pom and bundle contexts just in case.

                                • 13. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                                  mielket

                                  Hello,

                                   

                                  Thanks for offering your testcase. It will be used to verify the fix for this bug ESB-793.

                                  I just re-ran my steps again, using a new installation of FUSE ESB 4.1.0.2-fuse and ran into the same NoClassDefFoundError as you reported. But if you restart ServiceMix, that error will be gone. Seems like restarting SMX does reinitialize these packages in a different way.

                                   

                                  Btw, I tried to simply refresh or reinstall the AspectJ Weaver bundle but that did not resolve the NoClassDefFoundError exception.

                                  There is certainly a bigger bug here that needs to get resolved quickly.

                                  • 14. Re: Spring AOP AspectJ ClassNotFound in an OSGi bundle
                                    oren

                                    Thank you so much for resolving this issue! I verify that after restarting FUSE, the AspectJ error disappears and the AOP config problem () occurs. Do you want me to leave this thread open for a little while, fix my testcase so that it work flawlessly after the bus restart, and send it your way? I suppose we can then close the thread and mark it as answered, even though we may want to signal developers that this issue will really be resolved only in a future FUSE version. What do you think?

                                    1 2 Previous Next