org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 在春天 [英] org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException in spring

查看:31
本文介绍了org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 在春天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemalocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">


<context:property-placeholder location="classpath:/database.properties" />


<context:component-scan base-package="com.dineshonjava" />
<tx:annotation-driven transaction-manager="hibernateTransactionManager" />


<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver"
    id="jspViewResolver">
    <property name="prefix" value="/WEB-INF/view/"></property>
    <property name="suffix" value=".jsp"></property>
</bean>

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
</bean>

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

    <property name="dataSource">
        <ref bean="dataSource" />
    </property>

    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
        </props>
    </property>

    <property name="annotatedClasses">
        <list>
            <value>com.dineshonjava.model.Employee</value>
        </list>
    </property>
</bean>

<bean class="org.springframework.orm.hibernate3.HibernateTransactionManager"
    id="hibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean>
</beans>  

我是春天的新人.我有 org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/config/sdnext-servlet.xml] is invalid;嵌套异常是 org.xml.sax.SAXParseException;行号:8;列数:120;cvc-elt.1:找不到元素beans"的声明.在 spring 配置文件中.提前致谢.

I am new in spring. I have org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from ServletContext resource [/WEB-INF/config/sdnext-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 120; cvc-elt.1: Cannot find the declaration of element 'beans'. in spring configuration file.Thanks in advance.

推荐答案

我认为您的架构位置无效.所以请将spring配置文件中的xsi:schemalocation改为xsi:schemaLocation.

I think your schema location is not valid. So please change the xsi:schemalocation to xsi:schemaLocation in spring configuration file.

<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:mvc="http://www.springframework.org/schema/mvc"     xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">

..........

</beans>

这篇关于org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException 在春天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆