Got UnknownAdviceTypeException when using spring AOP in FUSE-4.3.0
xiaotao183 Oct 20, 2010 1:30 AMHi,
I am trying to inject logger to the osgi service using spring AOP framework.
Here is the bean.xml
Here is the logger
package services.servicemgmt;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class LoggingInterceptor implements MethodBeforeAdvice
{
@Override
public void before(Method arg0, Object[] arg1, Object arg2) throws Throwable
{
System.out.println("intecepting -
" + arg0.getName());
}
}
When I deployed this bundle to fuse-4.3.0, I got the following error
Exception in thread "SpringOsgiExtenderThread-34" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#0': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'maintenanceServiceBean': FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Unknown advisor type class services.servicemgmt.LoggingInterceptor; Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or TargetSource; nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object is neither a supported subinterface of nor an
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
at java.lang.Thread.run(Thread.java:637)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'maintenanceServiceBean': FactoryBean threw exception on object creation; nested exception is org.springframework.aop.framework.AopConfigException: Unknown advisor type class services.servicemgmt.LoggingInterceptor; Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or TargetSource; nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object is neither a supported subinterface of nor an
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1414)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:167)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 14 more
Caused by: org.springframework.aop.framework.AopConfigException: Unknown advisor type class services.servicemgmt.LoggingInterceptor; Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or TargetSource; nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object is neither a supported subinterface of nor an
at org.springframework.aop.framework.ProxyFactoryBean.namedBeanToAdvisor(ProxyFactoryBean.java:587)
at org.springframework.aop.framework.ProxyFactoryBean.addAdvisorOnChainCreation(ProxyFactoryBean.java:543)
at org.springframework.aop.framework.ProxyFactoryBean.initializeAdvisorChain(ProxyFactoryBean.java:461)
at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:240)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 21 more
Caused by: org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object is neither a supported subinterface of nor an
at org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry.wrap(DefaultAdvisorAdapterRegistry.java:60)
at org.springframework.aop.framework.ProxyFactoryBean.namedBeanToAdvisor(ProxyFactoryBean.java:582)
... 25 more
Thanks
Edited by: xiaotao183 on Oct 20, 2010 5:30 AM