Announcement Announcement Module
Collapse
No announcement yet.
"can't find referenced pointcut" Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • "can't find referenced pointcut" Error

    I get the "can't find referenced pointcut" error when trying to JUnit test my aspect. I believe to have everything in order according to the documentation. Any suggestions?

    Thanks,
    Lou

    Code Snippet:
    Code:
       @Pointcut("com.xxx.pds.xxx.sca.service.impl.ScaProductServiceFacade.saveProductRequest() && " + 
        "argNames(request,user)")
        private void checkSaveOrUpdateRequest(BaseRequest request, ScaUser user) {}
    
        @After("checkSaveOrUpdateRequest(request, user)")
        public void addChangeHistory(BaseRequest request, ScaUser user) {
    ...
    AppCtx.xml:

    Code:
    	<aop:aspectj-autoproxy />
    	<bean id="changeHistoryInterceptor2"
    		class="com.xxx.pds.xxx.sca.aspects.ChangeHistoryInterceptor2">
    		<property name="changeHistoryDao">
    			<ref local="ChangeHistoryDao" />
    		</property>
    		<property name="notificationService">
    			<ref local="notificationService" />
    		</property>
    	</bean>
    Exception:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myDSN' defined in file [C:\eclipse_workspaces\pds_sca\SCApprovalDao\bin\applicationContextDEV-SCADao.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut saveProductRequest
    Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut saveProductRequest
    	at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:315)
    	at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:159)
    	at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:149)
    	at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:134)
    	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:165)
    	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225)
    	at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:255)
    	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:73)
    	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:57)
    	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:255)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:312)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1033)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:181)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:151)
    	at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:105)
    	at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:82)
    	at junit.framework.TestCase.runBare(TestCase.java:125)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
    	at junit.framework.TestResult$1.protect(TestResult.java:106)
    	at junit.framework.TestResult.runProtected(TestResult.java:124)
    	at junit.framework.TestResult.run(TestResult.java:109)
    	at junit.framework.TestCase.run(TestCase.java:118)
    	at junit.framework.TestSuite.runTest(TestSuite.java:208)
    	at junit.framework.TestSuite.run(TestSuite.java:203)
    	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

  • #2
    The pointcut definition looks very suspicious. Does ScaProductServiceFacade define the saveProductRequest() pointcut (not method) and where is argNames() pointcut defined?

    I think you are trying to select execution of the saveProductRequest() method and collect arguments as join point context. If so, you probably need (I am guessing a lot here):
    Code:
       
    @Pointcut("execution(* com.xxx.pds.xxx.sca.service.impl.ScaProductServiceFacade.saveProductRequest(..)) && " + 
        "args(request,user)")
    Please refer to AspectJ language for explanation of pointcuts and their meaning.

    -Ramnivas
    Last edited by ramnivas; Feb 1st, 2007, 09:19 AM.

    Comment


    • #3
      Originally posted by ramnivas View Post
      I think you are trying to select execution of the saveProductRequest() method and collect arguments as join point context. If so, you probably need (I am guessing a lot here):
      "Your instincts serve you well young Ramnivas!" -- Obi Won Kenobi voice

      Seriously, that's exactly what I want to do. I actually started that way cuz I'm more used of the AJDT way of creating pointcuts and then switched to mimic the docs so I could avoid configuring ajc for the rest of my developers (at least right now).

      Thanks for the quick pointer!

      Lou

      Comment


      • #4
        Can't find referenced pointcut error on RAD 7.5.0 and WAS 7.0.0.7

        Environment:
        RAD 7.5.0
        WAS 7.0.0.7
        IBM JDK 1.6 SER6
        Spring 2.50
        Maven 2.0.9
        Eclipse Maven Plugin 0.9.8.2


        All: On the server side, the pointcut ran fine for me, however when running a junit test via RAD 7.5 (Eclipse 3.4), I always received the error above. It turns out that the WAS 7.0 Server runtime contains an incompatible PointCutParser in the com.ibm.ws.jpa.jar file. My solution was to remove the WAS 7.0.0.7 server runtime from the classpath of the junit tests (or the Web Project as a whole) and rely upon the maven dependencies. Pointcut error disappeared.

        Comment

        Working...
        X