Niru
Niru

Reputation: 1547

@Annotation supported at Java 5 compliance level or above

I am getting the following error when I am trying to run one of my applications:

error the @annotation pointcut expression is only supported at Java 5 compliance level or above

The application uses AspectJ 6.0, AspectJWeaver 1.8, and SpringAspects 4.2 dependencies. I've checked that the JVM that is started is JDK 1.8 and JAVA_HOME is also set to my JDK 1.8 installation. Looking around from similar questions I see that the answer is to make sure that aspectjweaver be set to 1.8 and don't use AspectJ 1.5.4 with anything above JDK 1.6. Is there some other setting or configuration I can check?

A bit more of the stack trace:

Exiting with throwable: org.springframework.beans.factory.BeanCreationException:   
Error creating bean with name   org.springframework.context.event.internalEventListenerProcessor':  Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error the @annotation pointcut   expression is only supported at Java 5 compliance level or above
org.springframework.beans.factory.BeanCreationException:   
Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': Initialization of bean failed;  
nested exception is java.lang.IllegalArgumentException:   
error the @annotation pointcut expression is only supported at Java 5 compliance level or above

Upvotes: 3

Views: 6777

Answers (3)

Milk
Milk

Reputation: 2655

I had the same error message and stack trace with slightly different dependency versions.

Issue was lack of support for Java 9. Reverting to Java 8 resolved the issue.

Upvotes: 0

Carlos Rincon
Carlos Rincon

Reputation: 11

Check the java home. Verify that it is less than 7.

Uses java -version.

In jboss, for instance, verifiy standalone.bat and standalone.config.

Upvotes: 0

Niru
Niru

Reputation: 1547

Short: Don't deploy AspectJ 6.0 with conflicting AspectJWeaver 1.8 dependencies.

I suspect this won't be terribly helpful to anyone since the issue was incredibly niche. My local deployment had AspectJ 6.0 jar which came with packaged with it a older version of AspectJWeaver jar. The run command for the application set classpath from /myApp/lib/*.

To find out all the dependencies I did: sudo ps -ef | grep -i myApp followed by lsof -p <pid> > ~/tmp . I was able to use this because while the application had failures the process still started. I noticed an older version of aspectJWeaver in the class path and ended up deleting AspectJ 6.0 jar from my local classpath folder.

Upvotes: 1

Related Questions