Announcement Announcement Module
Collapse
No announcement yet.
problem using AspectJ AOP with Spring and Java 6 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem using AspectJ AOP with Spring and Java 6

    Hi,
    I am trying to use AspectJ AOP annotation-style with Java 6, and I get the following exception (yes, I am certain I am using Java 6):


    [java] org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdv isor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    [java] Caused by:
    [java] java.lang.IllegalArgumentException: error the @annotation pointcut expression is only supported at Java 5 compliance level or above
    [java] at org.aspectj.weaver.tools.PointcutParser.parsePoint cutExpression(PointcutParser.java:315)
    [java] at org.springframework.aop.aspectj.AspectJExpressionP ointcut.buildPointcutExpression(AspectJExpressionP ointcut.java:189)
    [java] at org.springframework.aop.aspectj.AspectJExpressionP ointcut.checkReadyToMatch(AspectJExpressionPointcu t.java:176)
    [java] at org.springframework.aop.aspectj.AspectJExpressionP ointcut.getMethodMatcher(AspectJExpressionPointcut .java:162)
    [java] at org.springframework.aop.aspectj.AbstractAspectJAdv ice.buildSafePointcut(AbstractAspectJAdvice.java:1 81)
    [java] at org.springframework.aop.aspectj.AspectJPointcutAdv isor.<init>(AspectJPointcutAdvisor.java:51)
    [java] at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    [java] at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
    [java] at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
    [java] at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
    [java] at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:85)

    etc.

    Please help!

    thank you,
    Olia

  • #2
    Realise you state the Java 6 is definately being used... but this could be caused if the compliance level of the compiler is not set to 5.0 or 6.0.
    For example in Eclipse, under Java Compiler preferences, I can choose to run and compile against 6.0 but set the compliance level to 1.4.
    Marc

    Comment


    • #3
      no, I've been through all that with a fine-toothed comb, both when I run it in Eclipse or through my ant build file. It used to work if I compiled with 5, but ran with 6, but now even that seems to be broken.

      Comment


      • #4
        An issue like this was fixed in the most recent release, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=164384

        Comment


        • #5
          Any luck getting to the bottom of this one?

          Thanks.

          Comment


          • #6
            Check the version of AspectJ you are using. This was a problem in 1.5.3 that was fixed in 1.5.4.

            -Ramnivas
            Last edited by ramnivas; Mar 27th, 2008, 12:56 PM.

            Comment


            • #7
              Yes I got to the bottom of that. Thanks!

              Comment

              Working...
              X