严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx]
Offending resource: file [D:\javaProgramFiles\tomcat-6.0.20\webapps\zoyeoa\WEB-INF\classes\test\spring\applicationContext.xml]web.xml配置如下:<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:aop="http://www.springframework.org/schema/aop" 
xmlns:tx="http://www.springframework.org/schema/tx" 
xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> 
<bean id="TUser" class="test.spring.TUser">
        <property name="username" value="小张"></property>
        <property name="allname" value="张三"></property>
        <property name="address" value="青岛市"></property>
    </bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
     <property name="configLocation">
         <value>classpath:spring/hibernate.cfg.xml</value>
     </property>   
</bean> 
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
     <property name="sessionFactory">
         <ref bean="sessionFactory"/>
     </property>
 </bean>
<tx:advice id="smAdvice" transaction-manager="transactionManager">
     <tx:attributes>
     <tx:method name="save*" propagation="REQUIRED"/>
         <tx:method name="del*" propagation="REQUIRED"/>
         <tx:method name="update*" propagation="REQUIRED"/>
     </tx:attributes>
 </tx:advice>
<aop:config>
<aop:pointcut id="smMethod" 
expression="execution(* test.service.impl.*.*(..))"/>
<aop:advisor pointcut-ref="smMethod" advice-ref="smAdvice"/>
 </aop:config></beans>

解决方案 »

  1.   

    自己弄了一下,又报这样的错了:
    Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [D:\javaProgramFiles\tomcat-6.0.20\webapps\zoyeoa\WEB-INF\classes\test\spring\applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive
    Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive
    at org.springframework.aop.aspectj.AspectJExpressionPointcut.<clinit>(AspectJExpressionPointcut.java:60)
    at java.lang.Class.forName0(Native Method)
      

  2.   

    难怪没人回,写错了。
    上面的web.xml应该是applicationContext.xml
      

  3.   

    java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive麻烦导入一下aspectj的包