Lit*_*ski 1 xml spring xsd hibernate
配置Hibernate时,我的配置文件中出现以下错误.
Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.1.xsd)
Run Code Online (Sandbox Code Playgroud)
当我查看"更多详情"时,它给了我以下内容:
sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://www.springframework.org/schema/beans,identifiedType'.
Run Code Online (Sandbox Code Playgroud)
我有一个applicationContext.xml文件,其架构定义(我导入我的hibernate-context.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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
..
..
<!-- Imports datasource configuration -->
<import resource="hibernate-context.xml" />
Run Code Online (Sandbox Code Playgroud)
我的hibernate-context.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:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
">
Run Code Online (Sandbox Code Playgroud)
我在这个文件(hibernate-context.xml)中得到了错误.我的思绪被吹了,我被卡住......如何摆脱这个错误?请指导!! :(
好的,问题得到了解决.我在这里写它作为未来参考任何陷入同样愚蠢情况的人.
我从hibernate-context.xml更改了这一行:
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
Run Code Online (Sandbox Code Playgroud)
至
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
Run Code Online (Sandbox Code Playgroud)
打败我为什么,但它解决了我得到的错误.
归档时间: |
|
查看次数: |
11134 次 |
最近记录: |