Announcement Announcement Module
Collapse
No announcement yet.
Throws Advice Problem- At least one handler method must be f Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Throws Advice Problem- At least one handler method must be f

    Hi All,

    I have defined the throws advice like this -

    public class ExceptionAdvice implements ThrowsAdvice {

    private static final String ERROR = "An unexpected error ";
    private static long incidentSeed = 1;
    private transient Log logger = LoggingInit.getLog(ExceptionAdvice.class.getName() );

    /**
    * Public constructor required as per coding standards, but not for general consumption.
    */
    public ExceptionAdvice() {
    }

    void afterThrowing(Throwable throwable) {
    processException(throwable);
    }


    void afterThrowing(BusinessException be){
    populateErrorMessages(be);

    if(logger.isInfoEnabled()) {
    logger.info(be.toString());
    }
    }

    }

    Please provide solution to following problem -
    When I configure this interceptor for my services bean, and start the app, I get following exception -

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'CachePopulator' defined in class path resource [global_beans.xml]: Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException: null
    java.lang.IllegalArgumentException: At least one handler method must be found in class class com.mftl.gfas.common.ExceptionAdvice
    at org.springframework.aop.framework.adapter.ThrowsAd viceInterceptor.<init>(ThrowsAdviceInterceptor.jav a:77)
    at org.springframework.aop.framework.adapter.ThrowsAd viceAdapter.getInterceptor(ThrowsAdviceAdapter.jav a:41)
    at org.springframework.aop.framework.adapter.DefaultA dvisorAdapterRegistry.getInterceptor(DefaultAdviso rAdapterRegistry.java:75)
    at org.springframework.aop.framework.AdvisorChainFact oryUtils.calculateInterceptorsAndDynamicIntercepti onAdvice(AdvisorChainFactoryUtils.java:74)
    at org.springframework.aop.framework.HashMapCachingAd visorChainFactory.getInterceptorsAndDynamicInterce ptionAdvice(HashMapCachingAdvisorChainFactory.java :46)
    at org.springframework.aop.framework.Cglib2AopProxy$P roxyCallbackFilter.accept(Cglib2AopProxy.java:765)
    at net.sf.cglib.proxy.Enhancer.emitMethods(Enhancer.j ava:950)
    at net.sf.cglib.proxy.Enhancer.emit(Enhancer.java:747 )
    at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer .java:481)
    at net.sf.cglib.transform.TransformingClassGenerator. generateClass(TransformingClassGenerator.java:33)
    at net.sf.cglib.core.DefaultGeneratorStrategy.generat e(DefaultGeneratorStrategy.java:25)
    at net.sf.cglib.core.AbstractClassGenerator.create(Ab stractClassGenerator.java:215)
    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer. java:368)
    at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:2 80)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:163)
    at org.springframework.aop.framework.Cglib2AopProxy.g etProxy(Cglib2AopProxy.java:124)
    at org.springframework.aop.framework.ProxyFactoryBean .getSingletonInstance(ProxyFactoryBean.java:241)
    at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:201)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:301)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:236)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:255)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at com.mftl.gfas.util.BeanFactory.<init>(BeanFactory. java:41)
    at com.mftl.gfas.util.BeanFactory.instance(BeanFactor y.java:28)
    at com.mftl.gfas.servlet.initialisation.Initialisatio n.init(Initialisation.java:31)

  • #2
    Have you tried making the handler methods public?

    Rob

    Comment


    • #3
      Thanks Rob, for your timely help.

      Could please tell me from your experience for the following issues -
      1. In some scenarios we need to choose to go for Web Service or EJB.
      When should we be chossing one over another ?

      2. Could you be able to tell us about Hibernate - when we should
      look for JDBC based solution over Hibernate as for some complex
      queries and large results sets Hibernate doesn't perform well ?

      Regards
      Shiv

      Comment

      Working...
      X