首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

Element type "tx:advice" must be declared.该如何处理

2013-12-13 
Element type tx:advice must be declared.hibernate+spring的事务管理问题运行程序时报出异常→ org.spr

Element type "tx:advice" must be declared.
hibernate+spring的事务管理问题
运行程序时报出异常→
 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 52 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Element type "tx:advice" must be declared.

我的applicationContext.xml 配置文件如下(报错的52行就是下面的第一行):
<tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
   <tx:method name="insert*" propagation="REQUIRED" />
   <tx:method name="delete*" propagation="REQUIRED" />
   <tx:method name="update*" propagation="REQUIRED" />
   <tx:method name="*" read-only="true" />
  </tx:attributes>
 </tx:advice>
 
 <aop:config>
  <aop:pointcut id="allManagerMethod" expression="execution(* dao.impl.*.*(..))" />
  <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice" />
 </aop:config>

请高手帮我看下是什么地方出了问题呀~~
[解决办法]
transactionManager这个bean设置了吗?


<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
[解决办法]
你把你的beans 里面的所有命名空间发来看看 你是不是没有tx对应的命名空间啊
[解决办法]
你可以局部的排除错误,先把<tx:advice/>里的代码去掉,一点点的去查找原因
[解决办法]
配置下
<!-- aop代理设置-->    
<aop:config proxy-target-class="true">       
</aop:config>  
我也是猜的。你可以试下

热点排行