0

我是一个项目,我使用 spring jdbc:embedded-database xml 配置进行 JUNIT 测试。春季版本是 4.3.3.RELEASE。当我尝试在 JBoss Developer Studio 7.1.1.GA 中配置 xml spring-jdbc 时,我遇到了以下问题:

在此行找到多个注释: - schema_reference.4: 无法读取架构文档' http://www.springframework.org/schema/jdbc/spring-jdbc.xsd ',因为 1) 找不到文档;2) 文件无法读取;3) 文档的根元素不是 . - cvc-complex-type.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 UI,如果我从 maven(或安装)启动测试,我没有任何错误。

我该如何解决这个问题?谢谢你的帮助。

4

1 回答 1

0

看起来 JBoss 在查找 war/jar 中的 xsd 文件时遇到了一些问题。

解决方法特定于 JBoss,如果您有一些 Redhat 帐户(我没有),请在此处详细说明:

https://access.redhat.com/solutions/2381041 https://access.redhat.com/solutions/62251

于 2017-10-13T09:50:39.827 回答