[jboss-jira] [JBoss JIRA] (WFLY-826) ModuleClassLoader breaks Aspect-J non-load-time-weaving aspects

Jarkko Rantavuori (JIRA) jira-events at lists.jboss.org
Mon Sep 9 07:19:04 EDT 2013


    [ https://issues.jboss.org/browse/WFLY-826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12802704#comment-12802704 ] 

Jarkko Rantavuori commented on WFLY-826:
----------------------------------------

It seems this same issue pop ups with anything looked up with jee:jndi-lookup lookups in spring context, with anything fetched directly from JNDI. Now hit the same thing with JMS resources.

The way to diagnoze this issue is to wire up a debugger, make an exception breakpoint on java.lang.IllegalArgumentException and check from call stack which class does it choke into. With JMS, the classes were org.hornetq.ra.HornetQRAConnectionFactoryImpl and org.hornetq.jms.client.HornetQQueue, so jboss-deployment-structure needed to contain internal modules org.hotnerq and org.hornetq.ra as dependencies to get around this issue and app back to work.
                
> ModuleClassLoader breaks Aspect-J non-load-time-weaving aspects 
> ----------------------------------------------------------------
>
>                 Key: WFLY-826
>                 URL: https://issues.jboss.org/browse/WFLY-826
>             Project: WildFly
>          Issue Type: Bug
>          Components: Class Loading
>         Environment: Windows 7
>            Reporter: Jarkko Rantavuori
>            Assignee: David Lloyd
>         Attachments: MyMethodTrace.java, MyMethodTraceAspect.java, spring-app-aop-datasource-1.0.0-BUILD-SNAPSHOT.war, spring-mvc-aop-datasource-app.zip
>
>
> Special measures need to be taken for load-time-weaving with aspects, but using them without load-time weaving works normally OOB. However, if this kind of Spring configuration is used:
>     <!-- Test to get a data source -->
>     <jee:jndi-lookup id="dataSource" jndi-name="jboss/datasources/ExampleDS"/>
>     <!-- AOP part -->
>     <bean id="methodTraceAspect" class="fi.eis.applications.jboss.poc.gemini.spring.aop.support.api.MyMethodTraceAspect"/>
>     <aop:aspectj-autoproxy />
>     <!-- end AOP -->
>     <bean class="fi.eis.applications.controllers.HomeController">
>         <constructor-arg ref="dataSource" />
>     </bean>
> 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. I'm aware of no workaround for this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list