-
1. Re: java.lang.ClassCastException
flavia.rainone Mar 25, 2008 9:31 AM (in response to vbatista)Hi!
This is due to a bug that we have found on a previous version of JBoss AOP. This bug is fixed now. Which is the JBoss AOP version you are using on JBoss 4.2.2?
I think it is an old one. In this case, all you have to do is update the JBoss AOP on your server. Download the newest version from our website and run the ant script located in the jboss-40-install/jboss-aop-jdk50.deployer directory of your download JBoss AOP (notice that you have to remove the current jboss-aop-jdk50.deployer of your 4.2.2. server before doing so.
If this is not the case, then it might be a bug. In this case, please, try changing the signature of your advice to the form below, and let me know if this solves the problem:public Object get(Invocation invocation)
-
2. Re: java.lang.ClassCastException
vbatista Mar 25, 2008 1:09 PM (in response to vbatista)Hi Flavia,
Thanks for your prompt reply. I made the change you suggested and now it is working fine. My method now looks like:public Object get(Invocation invocation) { if(invocation instanceof FieldReadInvocation) { return _get(((FieldReadInvocation)invocation)); } return null; }
where _get is my previous method:private Object _get(FieldReadInvocation invocation) ...
I am using AOP which comes bundled with JBoss-4.2.2.
Thanks.
Best regards,
Victor -
3. Re: java.lang.ClassCastException
flavia.rainone Mar 25, 2008 8:42 PM (in response to vbatista)Hi, Victor
As I thought, you are using a previous JBoss AOP version, that lacks the fix.
You will have to either stick with your fix, or you can also upgrade to our CR release, which will allow you to use your advice with the original signature. A third alternative would be editing your pointcut expression, in a way that it matches only field read joinpoints.