Announcement Announcement Module
No announcement yet.
Pointcut does not matching Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pointcut does not matching

    My application uses a library of gwt-dispatch. I'm trying to use AOP for specific purposes, I want to modify the type of exception generated servlet.

    In setting the AOP point out the following:

    <bean name="errorsAdviser" class="" />
      <aop:aspect id="exceptionCatcher" ref="errorsAdviser">
     	 <aop:pointcut id="exceptionCatcherPointCut" expression="execution(* net.customware.gwt.dispatch.server.spring..*.*(..))"/>
    	 <aop:after-returning method="afterReturning" pointcut-ref="exceptionCatcherPointCut"/>

    Pointed Class:
    package net.customware.gwt.dispatch.server.spring;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import net.customware.gwt.dispatch.server.Dispatch;
    import net.customware.gwt.dispatch.server.standard.AbstractStandardDispatchServlet;
    import org.springframework.beans.factory.BeanFactoryUtils;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.context.WebApplicationContext;
    public class SpringStandardDispatchServlet extends AbstractStandardDispatchServlet {
        private Dispatch dispatch;
        public void init(ServletConfig config) throws ServletException {
            WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext());
            dispatch = (Dispatch) BeanFactoryUtils.beanOfType(ctx, Dispatch.class);
        protected Dispatch getDispatch() {
            return dispatch;
    package net.customware.gwt.dispatch.server.standard;
    import net.customware.gwt.dispatch.client.standard.StandardDispatchService;
    import net.customware.gwt.dispatch.server.Dispatch;
    import net.customware.gwt.dispatch.shared.Action;
    import net.customware.gwt.dispatch.shared.DispatchException;
    import net.customware.gwt.dispatch.shared.Result;
    import net.customware.gwt.dispatch.shared.ServiceException;
    public abstract class AbstractStandardDispatchServlet extends RemoteServiceServlet implements
            StandardDispatchService {
        public Result execute( Action<?> action ) throws DispatchException {
            try {
                Dispatch dispatch = getDispatch();
                if ( dispatch == null )
                    throw new ServiceException("No dispatch found for servlet '" + getServletName() + "' . Please verify your server-side configuration.");
                return dispatch.execute( action );
            } catch ( RuntimeException e ) {
                log( "Exception while executing " + action.getClass().getName() + ": " + e.getMessage(), e );
                throw new ServiceException( e );
         * @return The Dispatch instance.
        protected abstract Dispatch getDispatch();

    However, the match does not occur, although in debugger I can see that the methods are executed.

    In what may be the problem? What am I doing wrong?
    Last edited by zupport; Apr 8th, 2012, 01:04 PM.

  • #2
    Please use the search this question has been answered numerous times before.

    Spring will only intercept beans it knowns (yours is apparently a servlet not under spring control) and next it will only intercept external and not internall method calls (due to the fact spring uses proxies).