-
Dec 24th, 2009, 08:34 AM
#1
ThrowsAdvice problem
Hi Friends,
I am trying to impliment ThrowsAdvice in my project. I am facing a strange problem.
Here is my throws advice implimentation class
public class DaoExceptionAdvice implements ThrowsAdvice{
private Log log = LogFactory.getLog(this.getClass());
public void afterThrowing(Exception ex) throws CustomException{
log.error("\n\t ***** Generic Exception Capture. Caught: "
+ ex.getClass().getName() + "\n\t ***** \n");
log.error(getStackTrace(ex));
throw new CustomException("Exception Capture in DAO" + "method name" , ex);
}
public void afterThrowing (Method m, Object[] args, Object target, Exception ex) throws CustomException{
System.out.println("***22");
// System.out.println("Exception Capture in DAO" + target);
//System.out.println("method name" + method.getName());
System.out.println("Exception caught: " + ex.getClass().getName());
System.out.println("***22\n");
throw new CustomException("Exception Capture in DAO" + "method name" , ex);
}
The problem is whenver I add the second afterThrowing method that takes 4 aruements, none of the methods get called when an exception is thown by my bean class.
If I remove the second method (with 4 arguments), the first method gets called with out any problem.
I am not sure why this is happening.
Here is my content from configuration file:
<bean id="daoThrowsAdvice" class="com.crowley.cos.app.exceptions.DaoException Advice"/>
<bean id="daoExceptionAdvice" class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
<property name="beanNames">
<value>*DAO</value>
</property>
<property name="interceptorNames">
<list>
<value>daoThrowsAdvice</value>
</list>
</property>
</bean>
Thanks in advance for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules