How are you creating the UserServiceImpl instance? AKA: how are you publishing the endpoint?
For the aspects to work, spring has to create the bean. If you just pass a classname into CXF, we'll just do a "newInstance" on it and get a basic object. Thus, you would need to have spring create it (<bean class="…" id="name"/>) and then reference that spring created bean. Hope that helps. Dan On Mar 13, 2013, at 11:50 AM, Rajagopal Chowdary Yendluri <[email protected]> wrote: > Hi, > > > Here is the scenario i am trying. > > 1. when an exception thrown from a web service i want to invoke an aspect > which is sending a mail to a mailing list. > > Here is the steps which i tried. > > 1. Added AspectJ support in applicaiton context by adding the following > line. > > *<aop:aspectj-autoproxy/>* > > 2. Written a new Aspect as following: > > > @Aspect > @Component > public class ExceptionMailer{ > > @AfterThrowing(pointcut="execution(* com.mycompany.*..impl.*.*(..))", > throwing ="ex") > public void sendExceptionMail(JoinPoint joinPoint) { > System.out.println(" Sending Email .....................again "); > } > } > > > 3. Here is my WebService class. > > package com.mycompany.common.services.impl; > @WebService(endpointInterface = > "com.mycompnay.common.services.UserService",serviceName="UserDetails") > @Service > public class UserServiceImpl implements UserService { > > public List<User> getUserDetails(String userId) throwsException { > > try { > throw new Exception("Msg Exception ...."); > } catch (Exception e) { > throw new Exception("xcepiton"); > } > } > @PostConstruct > public void init() { > SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); > } > } > > When i create a seperate project with the same pointcout and with the same > package structure it is working good, but not with CXF. > > Is there any way / we need to tell CXF, that i am using AspectJ AOP. > It is not throwing any exception, it is silently ignoring the Aspect. > > > -- > Regards, > Rajagopal Yendluri(Raj) -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
