Announcement Announcement Module
Collapse
No announcement yet.
load-time weaving on classes Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • load-time weaving on classes

    Hi,
    is there anything special I need to do to be able to use load-time weaving on classes that don't implement any interface? I was experimenting with it and ran into
    Code:
    java.lang.VerifyError: (class: be/test/App$$EnhancerByCGLIB$$4ce32774, method: getNumber signature: ()I) Inconsistent stack height 2 != 1
    As soon as I had my App class implement AppInterface this error was fixed. From what I understood from the reference manual, standard java Proxy's are used for interfaces, instead of cglib. So is this an issue in cglib or do I have to do something special to weave aspects into a class?

  • #2
    It is a well-known bug (or rather intentional limitation) in AspectJ that preclude it from proper handling of CGLIB-generated proxies. The team from AspectJ explains it as such (it is not exact quotation) "CGLIB performs formally legal but very unusual stack handling, to which AspectJ is unprepared".

    See https://bugs.eclipse.org/bugs/show_bug.cgi?id=160146 for detailed discussion.

    Workaround is to exclude CGLIB-generated proxies from weaving (by setting exclude inside aop.xml), look at above mentioned link.

    Regards,

    Oleksandr

    Originally posted by petervds View Post
    Hi,
    is there anything special I need to do to be able to use load-time weaving on classes that don't implement any interface? I was experimenting with it and ran into
    Code:
    java.lang.VerifyError: (class: be/test/App$$EnhancerByCGLIB$$4ce32774, method: getNumber signature: ()I) Inconsistent stack height 2 != 1
    As soon as I had my App class implement AppInterface this error was fixed. From what I understood from the reference manual, standard java Proxy's are used for interfaces, instead of cglib. So is this an issue in cglib or do I have to do something special to weave aspects into a class?

    Comment


    • #3
      Thanks al0,

      it's a shame though... On my previous project I had to work with an application from a third party vendor that had a dao layer that swallowed all exceptions from jdbc and just threw some vague exception saying "A database exception occurred, probably due to RI.", no mather what had gone wrong, be it a table that didn't exist, or an invalid column or invalid type... The application didn't use Spring, so I wanted to try and build some kind of 'toolkit' that allowed me to get this kind of information by weaving in some aspect... For JDBC it's fine since it's based on interfaces, but if I encounter a similar problem in some location that cannot be accessed through interfaces, I'll have to come up with something else...

      Regards,
      Peter

      Comment


      • #4
        Ok, it is not so bad - first of all there is workaround, just exclude non-appropriate classes from weaving (see link from my previous post, there are some details).

        And, secondly, AspectJ guys after all have prioritized the issue and planned some fix for it in 1.6.4 (which is not so far away).

        Regards,
        Oleksandr
        Originally posted by petervds View Post
        Thanks al0,

        it's a shame though... On my previous project I had to work with an application from a third party vendor that had a dao layer that swallowed all exceptions from jdbc and just threw some vague exception saying "A database exception occurred, probably due to RI.", no mather what had gone wrong, be it a table that didn't exist, or an invalid column or invalid type... The application didn't use Spring, so I wanted to try and build some kind of 'toolkit' that allowed me to get this kind of information by weaving in some aspect... For JDBC it's fine since it's based on interfaces, but if I encounter a similar problem in some location that cannot be accessed through interfaces, I'll have to come up with something else...

        Regards,
        Peter

        Comment

        Working...
        X