Spring事务管理器(注释样式)运行时错误 [英] Spring Transaction Manager (Annotation Style) Runtime Error
问题描述
因此,当我在Glassfish应用服务器中加载战争时,我本来就会遇到异常。我正在使用Spring的事务管理器与我的mysql数据库。报告的错误(完整堆栈跟踪)如下所示:
So essentially I am getting a exception when I load up my war in my glassfish application server. I am using Spring's transaction manager with my mysql database. The error reported (full stack trace) is as follows:
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文件如下:
My applicationContext.xml file is as follows:
<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。感谢任何建议或帮助。
I find this error to be pretty cryptic because the class it is whining about is not even in my application Context. I am using Spring 3.1 by the way. Thanks for any suggestions or help.
推荐答案
查看您的课程路径,并确保只有一个版本你所有的Spring依赖关系。
Look in your classpath and make sure there's only one version of all your Spring dependencies there.
这篇关于Spring事务管理器(注释样式)运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!