java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position

 

在搭建ssh项目的时候, 启动tomcat,出现了一系列的错误, 找啊找,找啊找. 错误如下所示:


java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position0

Caused by: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position 0
allManagerMethod
^

	at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:333)
	at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:308)
	at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:172)
	at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:162)
	at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:103)
	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:171)
	at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:231)
	at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:256)
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:68)
	at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:54)
	at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:247)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:311)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1038)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
	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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
	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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSing
leton(DefaultSingletonBeanRegistry.java:141)

 

在这个错误上面还有一系列的错误,我们知道SSH框架一旦配置文件在Dao层出现错误, Dao层上面的其他层都会抛出一系列的错误, 所以在多个错误列表中, 首先是从下向上解决问题, 所以堆栈中打印出关于AOP这块配置的错误如上述所示.

无从下手的情况下, 开始利用百度谷歌找答案, 把人家解决方法应用到自己的程序中, 结果也是无济于事.  最后不得不找到曾经配置正确的进行Copy, Copy之余在Myeclipse编译器中进行History比较,发现是AOP对方法的匹配这出现的错误. 错误代码如下:

<aop:config>
  <aop:pointcut id="allManagerMethod" expression="execution(* com.bjpowernode.drp.service.*.*(..))"/>
  <aop:advisor pointcut="allManagerMethod" advice-ref="txAdvice"/>
 </aop:config>


回想pointcut在敲写的时候,Alt+/提示就敲上去了, 没有注意是pointcut还是pointcut-ref, 在Myeclipse编译器是没有给出pointcut-ref的提示.  所以没有写上pointcut-ref,而是写上了错误的提示pointcut.

A君说他们使用的J2EE IDE是   , 压根就不会出现这样低级的错误, 我们只是习惯了使用Myeclipse, 其实有比Myeclipse更加强大的IDE, 我们没有去发现.


而在SSH框架以及其他的框架中, 框架的封装性良好, 但是对于程序员来解决问题就增加了些困难, 尤其是把一些IDE没有给出提示的, 自己手动输上去的, 就更要来来回回, 仔仔细细的一个单词一个单词检查了.   当然能copy的地方一定要去copy, 相信机器胜过相信自己, 相信自己胜过相信他人. 


当然对于这个错误的出现, 除了说明自己的马虎外, 也说明了Myeclipse这个工具也不是十分的人性化, 据A君说, 可以安装一系列的插件, 使IDE更加人性化.   


 一个好的工具会让我们节省好多时间,避免低级错误.针对上述错误, A君告诉我, 对于j2ee的另一个IDE intellij,就不会出现上述错误, 在你写XML的时候就会进行检查,并给出更细节的错误提示. 突然感叹高手都是善于发现利剑并运用的灵活灵现, 这中间的差距是在'不将就'这三个字上?还是不断的想改变一些不舒服的现状? 想法设法的利用工具, 让工具为我所用,而不是工具就这样了, 工具自己还不就那样了.

修炼吧~~~

 

 

你可能感兴趣的:(java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting '(' at character position)