here's where my conclusion comes from:
anonymous wrote :
| 2006-03-23 15:18:39,774 INFO [STDOUT] iterate binding
file:/wd/jboss-4.0.3SP1/server/sw/deploy/jboss-aop-jdk50.deployer/base-aop.xml35
| 2006-03-23 15:18:39,774 INFO [STDOUT] iterate binding
com.supportwizard.utils.aspects.DisposableAspect.manage -3339849675675546449
| 2006-03-23 15:18:39,778 INFO [STDOUT] method matched binding
com.supportwizard.utils.aspects.DisposableAspect.manageDisposableClasses public
void com.suppor
|
twizard.audit.ejb.AuditLogRecordBean.ejbHomeRemoveExpiredRecords(java.lang.Long,java.util.Date)
| 2006-03-23 15:18:39,778 INFO [STDOUT] [debug] added advisor:
com.supportwizard.audit.ejb.AuditLogRecordBean from binding:
com.supportwizard.utils.aspects.Di
| sposableAspect.manage -3339849675675546449
| 2006-03-23 15:18:39,999 INFO [STDOUT] iterate binding
com.supportwizard.utils.aspects.DisposableAspect.manage 990114006282699700
| 2006-03-23 15:18:40,004 INFO [STDOUT] method matched binding
com.supportwizard.utils.aspects.DisposableAspect.manageDisposableClasses public
void com.suppor
|
twizard.audit.ejb.AuditLogRecordBean.ejbHomeRemoveExpiredRecords(java.lang.Long,java.util.Date)
| 2006-03-23 15:18:40,004 INFO [STDOUT] [debug] added advisor:
com.supportwizard.audit.ejb.AuditLogRecordBean from binding:
com.supportwizard.utils.aspects.Di
| sposableAspect.manage 990114006282699700
|
this is the output of aop deployer with verbose messages enabled. It is clear
that aspect is applied twice.
When I try to rename "manage" advices into 2 different names, manageConstructor
and manageMethod, leaving @Bind directions intact,I start to get strange
ClassCastException's:
anonymous wrote :
| 19:12:48,799 ERROR [LogInterceptor] RuntimeException in method: public
abstract void
com.supportwizard.audit.interfaces.AuditLogRecordHome.removeExpiredRecords(java.lang.Long,java.util.Date)
throws java.rmi.RemoteException:
| java.lang.ClassCastException:
com.supportwizard.audit.ejb.AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612
| at
org.jboss.aop.advice.com.supportwizard.utils.aspects.DisposableAspect0.invoke(DisposableAspect0.java)
| at
com.supportwizard.audit.ejb.AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.invokeNext(AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.java)
| at
com.supportwizard.audit.ejb.AuditLogRecordBean.ejbHomeRemoveExpiredRecords(AuditLogRecordBean.java)
|
(everything was rebuilt from scratch, there are no stale classes in the
classpath)
Next, I've changed there bind expressions like this:
| @Bind(pointcut =
"execution(@com.supportwizard.utils.annotations.ManageDisposables->new(..)) OR
" +
|
"execution(*->@com.supportwizard.utils.annotations.ManageDisposables(..))")
| public Object manageConstructor(final ConstructorInvocation invocation)
throws Throwable {
| ...
| }
|
| @Bind(pointcut = "execution(*
@com.supportwizard.utils.annotations.ManageDisposables->*(..)) OR " +
| "execution(*
*->@com.supportwizard.utils.annotations.ManageDisposables(..))")
| public Object manageMethod(final MethodInvocation invocation) throws
Throwable {
| ...
| }
|
and now everything works as expected:
anonymous wrote :
| 19:28:44,995 INFO [STDOUT] java.lang.Exception: debug
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean_5_ConByMInvocation.invokeNext(AuditLogRecordBean_5_ConByMInvocation.java)
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.utils.aspects.DisposableAspect.possibleLocalDisposableCreation(DisposableAspect.java:182)
| 19:28:44,996 INFO [STDOUT] at
org.jboss.aop.advice.com.supportwizard.utils.aspects.DisposableAspect6.invoke(DisposableAspect6.java)
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean_5_ConByMInvocation.invokeNext(AuditLogRecordBean_5_ConByMInvocation.java)
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean.com$supportwizard$audit$ejb$AuditLogRecordBean$ejbHomeRemoveExpiredRecords$aop(AuditLogRecordBean.java:493)
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.invokeNext(AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.java)
| 19:28:44,996 INFO [STDOUT] at
com.supportwizard.utils.aspects.DisposableAspect.manageMethod(DisposableAspect.java:144)
| 19:28:44,997 INFO [STDOUT] at
org.jboss.aop.advice.com.supportwizard.utils.aspects.DisposableAspect0.invoke(DisposableAspect0.java)
| 19:28:44,997 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.invokeNext(AuditLogRecordBean$ejbHomeRemoveExpiredRecords_N6843938089359633612.java)
| 19:28:44,997 INFO [STDOUT] at
com.supportwizard.audit.ejb.AuditLogRecordBean.ejbHomeRemoveExpiredRecords(AuditLogRecordBean.java)
|
It looks like JBossAOP is confused when aspect has 2 advices with the same
names and pointcuts, but different signatures. Moreover, if there are 2 advices
with the same pointcut but different names (and even parameter types), we get
ClassCastExceptions
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3932180#3932180
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3932180
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user