Search code examples
java-8aspectjweblogic12caspectj-maven-plugin

AspectJ: Issue on Weblogic 12


I worked on a Java EE application with following configs:

  • JDK 1.7
  • AspectJ 1.7
  • Weblogic 12.1.3

However, after upgrading the configs to followings, all aspects with "call" wildcards have not worked properly and as a result, no joinpoints, which already hit, can be touched, now:

  • JDK Verion: 1.8.0_66
  • AspectJ Version: 1.8.7
  • Application Server: Weblogic 12.2.1

The aspect snippet is as follows:
@Before("call(public * com.gam.commons.core.api.services.Service+.(..)) && within(com.gam.calendar.biz.service.internal.impl.)") public void handle(JoinPoint thisJoinPoint) {
Class declaringType = thisJoinPoint.getSignature().getDeclaringType(); if (declaringType.isInterface()) { UserProfileTO userProfileTO = ((AbstractService) thisJoinPoint.getThis()).getUserProfileTO();/* Caller or this / ((Service) thisJoinPoint.getTarget()).setUserProfileTO(userProfileTO);/ Callee or target */ } }

Now, I am delightfully looking forward in case of any meaningful points you would have for feeding me.


Attention: My problem was due to something else, please look at my answer to glean more information about the issue.


Solution

  • I made a mistake as my problem was completely due to something else. As I updated my project to be compiled by JDK 1.8.0_66, I should have re-configured aspect-maven-plugin to be compatible with this upgrade. Fortunately, my problem has been solved by re-configuring the appropriate plugin on the POM file, as follows:

    <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>aspectj-maven-plugin</artifactId>
           <version>1.8</version>
           <dependencies>
               <dependency>
                   <groupId>org.aspectj</groupId>
                   <artifactId>aspectjrt</artifactId>
                   <version>1.8.7</version>
               </dependency>
               <dependency>
                   <groupId>org.aspectj</groupId>
                   <artifactId>aspectjtools</artifactId>
                   <version>1.8.7</version>
               </dependency>
            </dependencies>
            <configuration>                        
                <complianceLevel>1.8</complianceLevel>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test-compile</goal>                               
                    </goals>
                </execution>
            </executions>
        </plugin>
    

    More info about "aspectj-maven-plugin" is available on aspectj-maven-plugin