Error when using AspectJ AOP with Java 7
Asked Answered
T

2

23

I've updated Java to version "1.7.0_09-icedtea" (previously it was 1.6) and get the following message:

Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate be
an class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error the 
@annotation pointcut expression is only supported at Java 5 compliance level or above

Application had been compiled with java 1.6 and compiler compliance level was set to 1.6 as well. I'm using spring 3.1.0

Has anyone been able to get aspectj working under Java 7?

Telpher answered 28/3, 2013 at 9:38 Comment(1)
What version of aspectj are you using?Volauvent
V
34

AspectJ 1.5.4 is not designed to work with Java7. Try upgrading your version of AspectJ to 1.7.0 or higher (latest was 1.7.2 as of this writing).

(I had AspectJ/Java7 issues before, too)

Volauvent answered 28/3, 2013 at 13:37 Comment(2)
I changed aspectjweaver version to 1.6.12, now it works fine.Telpher
They've introduced Java7 weaving support in 1.6.12 M2. But full support only comes from 1.7.0 RC 1, bugs are fixed in 1.7.1, so the latest 1.7.2 is advised. See the release notes: eclipse.org/aspectj/doc/released/README-1612.html eclipse.org/aspectj/doc/released/README-170.htmlMotoring
S
1

If you are getting this error. just compile your program with jdk 1.6 and run it with jre 6. It will resolve your problem

Sennit answered 12/9, 2013 at 7:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.