Spring事务管理器(注解风格)运行时错误

2023-12-13

所以本质上,当我在 glassfish 应用程序服务器中加载战争时,我遇到了异常。我正在将 Spring 的事务管理器与我的 mysql 数据库一起使用。报告的错误(完整堆栈跟踪)如下:

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。感谢您的任何建议或帮助。


查看您的类路径并确保只有one所有 Spring 依赖项的版本。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring事务管理器(注解风格)运行时错误 的相关文章

随机推荐