2 Replies Latest reply on Sep 27, 2011 5:34 AM by valdar

    AopInvocationException on OSGI service

    maxpicoz

      Hello,

       

      I've a problem in accessing an OSGi service that is being caused by the Spring Aop.

       

      Basically I've a bean (ntripCasterConfigurator) that is instantiated and registered in the OSGI service registry (as ntripCasterConfService) with the interface CasterSourceTableService.

      The bundle that contains all the above staff is installed and successfully started. The OSGI service is also published with the appropriated interface (I've attached a snapshot of the servicemix log file).

       

      A second bundle is installed that contains a bean (ntripCasterConfImpl) that should be injected with a reference to the previously exported OSGi service. ServiceMix seems to successfully resolve the reference to the object, but when ntripCasterConfImpl tries to invoke a method of the OSGi service the following AopInvocationException is thrown:

      I've attached a zip file with anything that I guess may support analysis.

      Thanks to anyone who can help !

       

      Best Regards

      Massimo

       

      10:59:50,500 | ERROR | xtenderThread-14 | NTRIPCasterConfImpl              | ster_conf_ws.NTRIPCasterConfImpl   35 | 191 - ntrip-caster-conf-ws - 0.0.3.SNAPSHOT | NTRIPCasterConfImpl: Got exception AOP configuration seems to be invalid: tried calling method on target [CasterConfigurator [ntripCastersConf=[EdasCaster=CasterDescriptor , PcsCaster=CasterDescriptor ]]]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class

      org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method on target [CasterConfigurator [ntripCastersConf=[EdasCaster=CasterDescriptor , PcsCaster=CasterDescriptor ]]]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class

           at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

           at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)

           at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)

           at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

           at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)

           at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)

           at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

           at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)

           at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)

           at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

           at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)

           at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

           at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)

           at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)

           at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

           at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

           at $Proxy128.listCasters(Unknown Source)

           at it.next.seneca.cssg.cfe.ntrip_caster_conf_ws.NTRIPCasterConfImpl.setCasterConfService(NTRIPCasterConfImpl.java:32)[191:ntrip-caster-conf-ws:0.0.3.SNAPSHOT]

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_18]

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_18]

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_18]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_18]

           at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1106)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:896)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1350)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)[63:org.springframework.beans:3.0.3.RELEASE]

           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)[65:org.springframework.context:3.0.3.RELEASE]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[75:org.springframework.osgi.core:1.2.0]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[75:org.springframework.osgi.core:1.2.0]

           at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[75:org.springframework.osgi.core:1.2.0]

           at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[75:org.springframework.osgi.core:1.2.0]

           at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)[76:org.springframework.osgi.extender:1.2.0]

           at java.lang.Thread.run(Thread.java:619)[:1.6.0_18]

      Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_18]

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_18]

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_18]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_18]

           at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)

           ... 41 more

       

      </code>