java-Spring事务管理器(注释样式)运行时错误
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java-Spring事务管理器(注释样式)运行时错误,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2913字,纯文字阅读大概需要5分钟。
内容图文
因此,从本质上讲,在我的glassfish应用程序服务器中加载战争时,我会遇到一个例外.我在我的mysql数据库中使用Spring的事务管理器.报告的错误(完整堆栈跟踪)如下:
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.getAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
我的applicationContext.xml文件如下:
<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:sws="http://www.springframework.org/schema/web-services"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
<context:property-placeholder location="classpath:testjdbc.properties"/>
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="passwprd" value="${jdbc.password}" />
</bean>
<bean name="licenseGenService" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service" ref="LicensingDaoImpl"/>
<property name="serviceInterface" value="mypackage.LicensingDao"/>
</bean>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name ="dataSource" ref="dataSource" />
</bean>
<bean id="licenseDAO" class = "myPackage.LicenseDao">
<constructor-arg ref="dataSource" />
</bean>
<bean id="licenseGenerator" class ="myPackage.LicenseGeneratorImpl">
<constructor-arg ref = "licenseDAO" />
</bean>
</beans>
我发现此错误非常隐晦,因为它所抱怨的类甚至不在我的应用程序上下文中.我正在使用Spring 3.1.感谢您的任何建议或帮助.
解决方法:
查看您的类路径,并确保在那里所有Spring依赖项只有一个版本.
内容总结
以上是互联网集市为您收集整理的java-Spring事务管理器(注释样式)运行时错误全部内容,希望文章能够帮你解决java-Spring事务管理器(注释样式)运行时错误所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。