Announcement Announcement Module
Collapse
No announcement yet.
error at ::0 formal unbound in pointcut Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error at ::0 formal unbound in pointcut

    Upon context initialization in my web app, I'm receiving the following stack trace:

    11:20:23,576 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
    Caused by:
    java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
    at org.aspectj.weaver.tools.PointcutParser.parsePoint cutExpression(PointcutParser.java:315)
    at org.springframework.aop.aspectj.AspectJExpressionP ointcut.buildPointcutExpression(AspectJExpressionP ointcut.java:159)
    at org.springframework.aop.aspectj.AspectJExpressionP ointcut.checkReadyToMatch(AspectJExpressionPointcu t.java:149)
    at org.springframework.aop.aspectj.AspectJExpressionP ointcut.getClassFilter(AspectJExpressionPointcut.j ava:134)
    at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:166)
    at org.springframework.aop.support.AopUtils.canApply( AopUtils.java:226)
    at org.springframework.aop.support.AopUtils.findAdvis orsThatCanApply(AopUtils.java:256)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.findEligibleAdvisors(Abs tractAdvisorAutoProxyCreator.java:85)
    at org.springframework.aop.framework.autoproxy.Abstra ctAdvisorAutoProxyCreator.getAdvicesAndAdvisorsFor Bean(AbstractAdvisorAutoProxyCreator.java:69)
    at org.springframework.aop.framework.autoproxy.Abstra ctAutoProxyCreator.postProcessAfterInitialization( AbstractAutoProxyCreator.java:265)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac tory.java:316)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1094)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:429)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 50)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:141)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:247)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:161)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:270)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:346)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:156)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:246)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:184)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
    at
    ...


    The error is related to a new aspect definition as I can comment it out and have the context load with no error. Here is the definition:
    <aop:aspect id="userAspect" ref="userServiceAspect">
    <aop:after-returning
    pointcut="execution(* net.streamlinehealth.cmw.service.UserService.*(..) )"
    method="afterReturning" returning="returnValue"/>
    </aop:aspect>


    I've verified that I didn't fat finger the package name in the pointcut expression - any other ideas as to what is generating this message? I'm using Spring 2.0.2.

  • #2
    Can you provide the 'afterReturning' method declaration from the 'userServiceAspect' ?

    Comment


    • #3
      Sure...

      public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable

      Does that help?

      Comment


      • #4
        You can refactor the method like so:
        Code:
        public void afterReturning(JoinPoint joinPoint, Object returnValue) throws Throwable
        Then you would be able to retrieve the method, args, and target from the joinPoint object. Currently it's complaining because those other method args are not bound.

        Comment


        • #5
          Ok...

          1. I assume that I don't need to have my advice implement AfterReturningAdvice?
          2. Is this a bug in 2.0.2 or something? I followed the reference guide to use AfterReturningAdvice....

          Thanks for your help

          Comment


          • #6
            Identical error

            Hi guys,
            new to spring AOP so any help appreciated. I am getting the same error " error at ::0 formal unbound in pointcut". Works perfect in junit test but error when deployed to app server.

            My config:
            <bean id="loggingAspect"
            class="com.yada.MethodDebugLogger" />


            <aop:config>
            <aop:aspect ref="loggingAspect">
            <aopointcut id="myCutLogging" expression="execution(* com.yada.dao..*(..))" />
            <aop:around pointcut-ref="myCutLogging" method="log" />
            </aop:aspect>
            </aop:config>

            The dao is defined in the app ctx as well so I imagine it should be able to proxy ok. Using the exact same expression in unit test as in app server deployment but can't figure out what the problem is!?

            thanks in advance.

            Comment


            • #7
              Originally posted by tdennison View Post
              Ok...
              1. I assume that I don't need to have my advice implement AfterReturningAdvice?
              2. Is this a bug in 2.0.2 or something? I followed the reference guide to use AfterReturningAdvice....
              With Spring 2.0, the AspectJ expressions and aop namespace (or AspectJ annotations) can be used instead of implementing the interfaces (such as AfterReturningAdvice). The interface-based approach can still be used, but as demonstrated by the example you provided, using the AspectJ expression is typically a simpler option. The 'JoinPoint' object can always be provided as the first argument to an advice method and provides all of the context that you may need.

              Comment


              • #8
                error at ::0 formal unbound in pointcut

                I am having this same problem and would really appreciate some help. I have been perusing the blogs and net and can't seem to find the answer to this.

                here is the stack trace:

                ERROR org.springframework.web.context.ContextLoader - Context initialization failed
                org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'mil.army.inscom.csi.logging.LoggerInjectorBeanPos tProcessor#0' defined in class path resource [loggingContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.config.internalTr ansactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.Annota tionTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.annotation.Annota tionTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:405)
                at java.security.AccessController.doPrivileged(Native Method)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
                at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
                at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
                at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
                at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
                at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
                at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:880)
                at org.springframework.context.support.AbstractApplic ationContext.registerBeanPostProcessors(AbstractAp plicationContext.java:605)
                at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:365)
                at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
                at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)
                at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 45)
                at org.jboss.resteasy.plugins.spring.SpringContextLoa derListener.contextInitialized(SpringContextLoader Listener.java:44)
                at org.mortbay.jetty.handler.ContextHandler.startCont ext(ContextHandler.java:543)
                at org.mortbay.jetty.servlet.Context.startContext(Con text.java:136)
                at org.mortbay.jetty.webapp.WebAppContext.startContex t(WebAppContext.java:1220)
                at org.mortbay.jetty.handler.ContextHandler.doStart(C ontextHandler.java:513)
                at org.mortbay.jetty.webapp.WebAppContext.doStart(Web AppContext.java:448)
                at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
                at org.mortbay.jetty.handler.HandlerCollection.doStar t(HandlerCollection.java:152)
                at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
                at org.mortbay.jetty.handler.HandlerWrapper.doStart(H andlerWrapper.java:130)
                at org.mortbay.jetty.Server.doStart(Server.java:222)
                at org.mortbay.component.AbstractLifeCycle.start(Abst ractLifeCycle.java:39)
                at org.mortbay.xml.XmlConfiguration.main(XmlConfigura tion.java:977)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:597)
                at org.mortbay.start.Main.invokeMain(Main.java:194)
                at org.mortbay.start.Main.start(Main.java:512)
                at org.mortbay.start.Main.main(Main.java:119)
                Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.config.internalTr ansactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.Annota tionTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.transaction.annotation.Annota tionTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut
                at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:275)
                at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:104)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1245)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1010)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:472)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
                at java.security.AccessController.doPrivileged(Native Method)
                at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
                at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
                at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
                at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
                at .................


                And here is the critical context.xml:

                <?xml version="1.0" encoding="UTF-8"?>
                <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:context="http://www.springframework.org/schema/context"
                xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
                xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schem...ng-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schem...ng-aop-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">

                <aop:aspectj-autoproxy proxy-target-class="true" />

                <bean id="csiRuntimeExceptionAdvice" class="mil.army.inscom.csi.services.CsiRuntimeExce ptionAdvice" />
                </beans>

                So there it is any help would be greatly appreciated. Thanks

                Comment


                • #9
                  Can you post the advice implementation?

                  Comment


                  • #10
                    Sure... appreciate the help. I tried implementing the ThrowsAdvice interface also.

                    Here is the advice implementation:

                    import org.aspectj.lang.JoinPoint;
                    import org.aspectj.lang.annotation.AfterThrowing;
                    import org.aspectj.lang.annotation.Aspect;
                    import org.aspectj.lang.annotation.Pointcut;
                    import org.springframework.stereotype.Service;

                    import org.springframework.beans.factory.annotation.Autow ired;
                    import org.springframework.stereotype.Component;
                    //import org.springframework.aop.ThrowsAdvice;

                    @Aspect
                    public class CsiRuntimeExceptionAdvice //implements ThrowsAdvice
                    {

                    public CsiRuntimeExceptionAdvice () {}

                    @Pointcut("execution(* *(..))")
                    public void runtimeException() {}

                    @AfterThrowing("runtimeException()")
                    public void afterThrowing(Throwable e)
                    {
                    System.out.println("AOP Runtime CAUGHT: " + e.getMessage());
                    }
                    }

                    Comment

                    Working...
                    X