【问题标题】:the matching wildcard is strict but no declaration can be found for element 'osgi:service'匹配的通配符是严格的,但找不到元素“osgi:service”的声明
【发布时间】:2014-07-23 08:28:33
【问题描述】:
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/osgi 
                        http://www.springframework.org/schema/osgi/spring-osgi.xsd"
    xmlns:osgi="http://www.springframework.org/schema/osgi">

这些是我得到的错误:

  • 匹配的通配符是严格的,但找不到元素“osgi:service”的声明
  • 匹配的通配符是严格的,但找不到元素“osgi:reference”的声明

【问题讨论】:

  • +1,这类问题在 Spring XML 配置中是一个很常见的陷阱。

标签: java spring osgi


【解决方案1】:

我在第 6 行将版本添加到 shemaLocation。

您可以在这里找到所有版本(第 5 行):http://www.springframework.org/schema/osgi

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/osgi 
                        http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd"
    xmlns:osgi="http://www.springframework.org/schema/osgi">

【讨论】:

    猜你喜欢
    • 2012-08-26
    • 2021-11-02
    • 2017-10-20
    • 2014-08-07
    • 1970-01-01
    • 2015-12-05
    • 2011-08-28
    • 2012-11-18
    • 2012-11-15
    相关资源
    最近更新 更多