Community
Participate
Working Groups
Created attachment 225417 [details] source code for the used app Using aspects without load-time weaving works for the regular use cases. However, if this kind of Spring configuration is used: <jee:jndi-lookup id="dataSource" jndi-name="jboss/datasources/ExampleDS"/> <bean id="methodTraceAspect" class="fi.eis.applications.jboss.poc.gemini.spring.aop.support.api.MyMethodTraceAspect"/> <aop:aspectj-autoproxy /> JBoss tries to use methodTraceAspect also on the data source. Data source is loaded by ModuleClassLoader that in has only visibility to org.jboss.jca.adapters* classes (confirmed with a debugger), so it cannot find the aspect class anymore, making aspect-j throw org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of missing type fi.eis.applications.jboss.poc.gemini.spring.aop.support.api.MyMethodTraceAspect [Xlint:cantFindType]. This has large problems in bigger applications, where general AOP pointcuts are used - no jboss-module stuff can be used as beans, anywhere. There are lot of stuff, such as mybatis-spring, that expect a bean parameter of type DataSource. I'm aware of no workaround for this.
Created attachment 225418 [details] source code for the used aspect
Found a workaround for this: create a custom data source wrapper, like <bean id="serviceLocator" class="fi.eis.applications.jboss.poc.gemini.spring.aop.beans.ServiceLocator" factory-method="getInstance" /> <bean id="dataSource" class="fi.eis.applications.jboss.poc.gemini.spring.aop.beans.OurDataSourceProxy"> <constructor-arg ref="serviceLocator" /> <constructor-arg> <value>jboss/datasources/ExampleDS</value> </constructor-arg> </bean> This would be needed for all datasources.