Java Spring命名空间错误

Java Spring命名空间错误,java,hibernate,spring,Java,Hibernate,Spring,在测试过程中,我不断遇到以下错误: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.springframework.org/schema/context] 它源自我的persistenceLayer.xml文件。这是它的代码: &l

在测试过程中,我不断遇到以下错误:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.springframework.org/schema/context]
它源自我的persistenceLayer.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"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <bean id="persistenceManager" class="com.apollo.counterpartcontacts.service.PersistenceManager">
    </bean>

    <tx:annotation-driven transaction-manager="txManager"/>
    <context:annotation-config /> 

    <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="CounterpartContactDataSource" /> 
        <property name="persistenceUnitName" value="CounterpartContacts" />
        <property name="loadTimeWeaver">
        <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
        </property>
    </bean>

</beans>
下面是类路径:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_26">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <classpathentry kind="src" path="flex_src">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="C:/sqljdbc_3.0/enu/sqljdbc4.jar"/>
    <classpathentry kind="output" path="build/classes"/>
</classpath>

有人知道这里出了什么问题吗?

这可能会有所帮助:

您似乎试图将Spring 2.5命名空间声明与Spring 3.0.5 JAR一起使用。使用一个或另一个;不要混在一起

作为记录,我在3.0.5版本JAR的代码中使用了这类东西,因此它应该与您的情况相当,并且对我有效:

http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
我之前看过。问题是我有最新版本的Spring,所以我不知道这是否真的适用于我。很好的一点是,我过去有过这种版本冲突,给了我很多不必要的挑战,这些挑战不是直接就能解决的。虽然这很有意义,但并没有解决错误。仍然得到相同的输出。
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_26">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <classpathentry kind="src" path="flex_src">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="C:/sqljdbc_3.0/enu/sqljdbc4.jar"/>
    <classpathentry kind="output" path="build/classes"/>
</classpath>
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd