Spring错误:Error creating bean with name 'userTransaction' defined in class path resource

spring启动失败
org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition.
Group resource name [classpath*:beanRefFactory.xml], factory key [default]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'default'
defined in URL [file:/F:/work/fee/fee/WebContent/WEB-INF/classes/beanRefFactory.xml]: Instantiation of
bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate
class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw
exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userTransaction' defined in class path resource [applicationContext.xml]:

Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Name UserTransaction is not bound in this Context
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'default'
defined in URL [file:/F:/work/fee/fee/WebContent/WEB-INF/classes/beanRefFactory.xml]: Instantiation of
bean failed;

nested exception is org.springframework.beans.FatalBeanException: Could not instantiate
class [org.springframework.context.support.ClassPathXmlApplicationContext]; constructor threw
exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error
错误说 Name UserTransaction is not bound in this Context,可是我在tomcat的xml文件中配置了UserTransaction。
第一张图是properties文件,
第二张图是tomcat的xml,
第三张是application.xml的UserTransaction配置

Tomcat是一个Web容器,并不是JavaEE服务器。Tomcat除了提供数据源的支持外,对于其它JavaEE规范并不实现。也就是说Tomcat容器不支持JTA。所以,你无法在Tomcat容器中使用JTA。如果你想使用容器提供的JTA来控制事务,那么请选择JavaEE服务器,例如JBoss。否则在Tomcat中请使用程序控制事务,例如DataSourceTransactionManager事务管理器。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-08-27
xml文件 放在 src文件夹下

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网