我使用spring :embedded-database配置进行JUNIT测试。spring版本为4.3.3.RELEASE。当我尝试在JBoss Developer Studio 7.1.1.GA中配置xml时,我遇到了以下问题:
在这一行中找到多个注释:- schema_reference.4:未能读取模式文档'http://www.springframework.org/schema/jdbc/spring-jdbc.xsd',因为1)找不到文档;2)文档无法读取;3)文档的根元素不是。-cvc-complex- The .2.4.c:匹配的通配符是严格的,但是元素jdbc:embedded-database没有任何声明。
失败的配置如下
<?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:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
...
<jdbc:embedded-database id="dataSource" type="H2" />相反,使用
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">JBoss Developer Studio不会出现错误。
此外,我注意到错误仅来自JBoss Developer Studio,如果我从maven (或install)启动测试,则没有任何错误。
我怎么才能解决这个问题?谢谢你的帮助。
发布于 2017-10-13 09:50:39
看起来,JBoss在war/jar中查找xsd文件时遇到了一些问题。
解决方法是特定于JBoss的,如果您有一些Redhat帐户(我没有),请在这里提供详细信息:
https://access.redhat.com/solutions/2381041 https://access.redhat.com/solutions/62251
https://stackoverflow.com/questions/46726148
复制相似问题