3 Replies Latest reply on Jan 16, 2013 3:28 AM by jrantav

    AS7 and Aspect-J without LTW

    jrantav

      We use Aspect-J without load-time weaving, and it doesn't seem to work with AS7. I am aware of instructions in http://wiki.eclipse.org/LTWJboss7, but what about the case where LTW is not used?

       

      We get Xlint:cantFindType for all the classes when the same war works on other application servers.

       

      Similar issue is reported at http://stackoverflow.com/questions/13943110/aspectj-aspect-under-jboss-as-7-throws-xlintinvalidabsolutetypename

       

      based on that thread, this used to work on AS6, too.

       

      I am working with latest AS7 snapshot. I have also tried with 7.1. Final, having the same issue.

        • 1. Re: AS7 and Aspect-J without LTW
          jrantav

          The problem doesn't seem to be with Aspect-J as such, as a quick demo application using Aspect-J the same mechanism works just fine. However, a more complex one with aspects in one jar and configuration in another doesn't seem to find any aspect classes on AS7, but works fine on other app server.

          • 2. Re: AS7 and Aspect-J without LTW
            jrantav

            Ok, I think I've found the problem relate to ModuleClassLoader and jboss modules. On a regular case it works fine. However, having this kind of spring configuration:

             

                 <!-- Enables the Spring MVC @Controller programming model -->
                <mvc:annotation-driven />
            
                <!-- 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>
            

             

             

            will, since dataSource comes from JBoss internal modules, try to attach AOP trace to that data source, too. This will fail with IllegalArgumentException, coming from:

            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]
            

             

             

            since dataSource is loaded by ModuleClassLoader, and that classloader only has visibility to classes org.jboss.jca.adapters.* classes, as can be seen from the debugger.

            1 of 1 people found this helpful
            • 3. Re: AS7 and Aspect-J without LTW
              jrantav

              Fixed with

              "Dependencies: org.jboss.ironjacamar.jdbcadapters"

              in the manifest.