2 anurnomeru anurnomeru 于 2017.01.16 11:13 提问

spring AOP报错 Cannot resolve reference to bean

使用原本的事务管理:
图片说明

发布到tomcat是没有报错的,

但是在运行action时,

页面出现了
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
图片说明



-------------------------------------------------------------------------------为了解决这个问题

我在百度后,添加了事务管理的设置:


!!!另外说明,我ctrl点击
http://www.springframework.org/schema/aop/spring-aop.xsd
的时候,页面现了404的错误

图片说明
图片说明
图片说明

报错内容:百度了以后说是**少了什么包还是什么的**
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'allmethods' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'allmethods': Failed to introspect bean class [org.springframework.aop.aspectj.AspectJExpressionPointcut] for lookup method metadata: could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
这是我的spring包:(**是不是少了什么?**)
图片说明

还是说另有原因?

3个回答

JE_GE
JE_GE   2017.01.16 12:49
已采纳

jar文件不够,如
com.springsource.org.aopalliance-1.0.0.jar
com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar
图片说明

anurnomeru
anurnomeru 我已经下了AOP包不过是从CSDN下的...
11 个月之前 回复
anurnomeru
anurnomeru 有一个疑问,如果您看到并且有时间的话:AOP包是从哪里下的?(官网)
11 个月之前 回复
anurnomeru
anurnomeru 自己已经解决了。确实是少了包,谢谢~
11 个月之前 回复
lihongbiao0610
lihongbiao0610   Rxr 2017.01.16 14:21

aspectjweaver.jar

zzg1229059735
zzg1229059735   2017.01.16 15:46

Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
仔细读一下这一句爆粗信息,看看是否解决你的问题

anurnomeru
anurnomeru 添加了对应事务以后,依然报错,最后解决了..
11 个月之前 回复
anurnomeru
anurnomeru Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition.
11 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!