小编Ith*_*har的帖子

匹配的通配符是严格的,但是没有为元素'context:component-scan'找到声明

我正在使用带有maven的Spring 3.2.3.RELEASE来提取依赖项.在Eclipse中构建项目时出现以下错误:

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [META-INF/spring/application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 64; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
Run Code Online (Sandbox Code Playgroud)

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

  <context:component-scan base-package="com.example" />
Run Code Online (Sandbox Code Playgroud)

我知道我正在提取正确的jar文件,因为我的Maven依赖项显示:

Eclipse Maven依赖项

在META-INF/sping.schemas中,我可以看到我的jar中有正确的模式声明:

http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd
http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd
http\://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd
Run Code Online (Sandbox Code Playgroud)

我也看了这些无济于事:

无法加载spring 3架构

匹配的通配符是严格的,但是找不到元素'tx:annotation-driven'的声明

元素'context:component-scan'没有声明

匹配的通配符是严格的,但是找不到元素'context:component-scan的声明

请帮忙,这让我发疯了...... :(

spring

6
推荐指数
1
解决办法
2万
查看次数

cucumber-jvm java HelloWorld示例OutOfBoundsException错误

我想帮助运行这个包中的java cucumber'hello world'示例: cucumber.examples.java.helloworld.HelloStepdefs

我想知道我的设置错过了什么吗?

我一直收到以下错误:

Feature: Hello World  Time elapsed: 0 sec  <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at gherkin.formatter.PrettyFormatter.indentedLocation(PrettyFormatter.java:142)
    at gherkin.formatter.PrettyFormatter.printStep(PrettyFormatter.java:255)
    at gherkin.formatter.PrettyFormatter.match(PrettyFormatter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cucumber.runtime.Utils$1.call(Utils.java:44)
    at cucumber.runtime.Timeout.timeout(Timeout.java:12)
    at cucumber.runtime.Utils.invoke(Utils.java:40)
    at cucumber.runtime.RuntimeOptions$2.invoke(RuntimeOptions.java:138)
    at $Proxy11.match(Unknown Source)
    at cucumber.runtime.junit.JUnitReporter.match(JUnitReporter.java:61)
    at cucumber.runtime.Runtime.runStep(Runtime.java:250)
    at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:49)
    at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:43)
    at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:36)
    at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:83)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63)
    at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18)
    at …
Run Code Online (Sandbox Code Playgroud)

java bdd cucumber

4
推荐指数
1
解决办法
2230
查看次数

标签 统计

bdd ×1

cucumber ×1

java ×1

spring ×1