[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] LTW problem ...

On 12/29/06, Fabio Fagundes Silveira <ffs@xxxxxx> wrote:
Hello,

   I have the following code on a aspect transaction manager:

        pointcut illegalConnectionManagement()
        :(call(void Connection.close())
                || call(void Connection.commit())
                || call(void Connection.rollback())
                || call(void Connection.setAutoCommit(boolean)))
                &&
                !within(persistence.TransactionControlAspect);

        declare error:illegalConnectionManagement():
         "Transaction and connection control must be make" +
         "only by TransactionControlAspect." ;

   Ok, everything works fine just I run this application using:

        [ffs@aston ~/app/classes]$ java main.Main

   But if I try to run it using LTW:

        [ffs@aston ~/app/classes]$ aj5 main.Main

   I get:

[AppClassLoader@18e3e60] error at com/mysql/jdbc/Connection.java:2712::0
Transaction and connection control must be makeonly by
TransactionControlAspect. see also:
persistence/app/src/persistence/TransactionControlAspect.aj:79::0

    Why I am getting my own the declared error above? I have a correct
aop.xml to use LTW ...

    Anyway, If a delete META-INF directory and aop.xml file and rerun
aj5 again, everything works fine as before ... :-(

    Any hint?

Regards,
Fabio


Your pointcut is not restricted to your code only, so when using LTW, any 3rd party code gets weaved - including the JDBC driver - where it might internally use those calls.

./alex
--
.w( the_mindstorm )p.