2017-10-10 83 views
2

私はSpring Framework 4.0.6でWebアプリケーションを作成しています。毎日同じ時間に実行する小さなルーチンをスケジュールします。 @Scheduledアノテーションを使用して、私のdispatcher-servlet.xmlにタグを追加することで試していますが、アプリケーションの起動時にSAXParseExceptionが発生します。cvc-complex-type.2.4.c:一致するワイルドカードは厳密ですが、要素 'task:annotation-driven'の宣言が見つかりません

<?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:util="http://www.springframework.org/schema/util" 
    xmlns:sws="http://www.springframework.org/schema/web-services" 
    xmlns:int="http://www.springframework.org/schema/integration" 
    xmlns:int-ws="http://www.springframework.org/schema/integration/ws" 
    xmlns:jee="http://www.springframework.org/schema/jee" 
    xmlns:jpa="http://www.springframework.org/schema/data/jpa" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xmlns:task="http://www.springframework.org/task/spring-task" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/web-services 
    http://www.springframework.org/schema/web-services/web-services.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context.xsd 
    http://www.springframework.org/schema/util 
    http://www.springframework.org/schema/util/spring-util.xsd 
    http://www.springframework.org/schema/integration 
    http://www.springframework.org/schema/integration/spring-integration.xsd 
    http://www.springframework.org/schema/integration/ws 
    http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd 
    http://www.springframework.org/schema/jee 
    http://www.springframework.org/schema/jee/spring-jee.xsd 
    http://www.springframework.org/schema/data/jpa 
    http://www.springframework.org/schema/data/jpa/spring-jpa.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-4.0.xsd 
    http://www.springframework.org/schema/task 
    http://www.springframework.org/schema/task/spring-task.xsd"> 

<context:component-scan base-package="com.somepackage" /> 
    <sws:annotation-driven /> 
    <tx:annotation-driven transaction-manager="transactionManager"/> 
    <task:annotation-driven /> 

私は取得していますエラーは以下の通りです:あなたの答えを事前に

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 37 in XML document from ServletContext resource [/WEB-INF/spring-ws-servlet.xml] is invalid; nested exception is org. 
    xml.sax.SAXParseException; lineNumber: 37; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'task:annotation-driven'. 
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399) 
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) 
      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) 
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) 
      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) 
      Truncated. see log file for complete stacktrace 
    Caused By: org.xml.sax.SAXParseException; lineNumber: 37; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'task:annotation-driven 
    '. 
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) 
      at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) 
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) 
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) 
      at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) 
      Truncated. see log file for complete stacktrace 

おかげで私のxmlファイルはこれです。間違いである

答えて

0

ルック:だから

xmlns:task="http://www.springframework.org/task/spring-task" 

、あなたはspring-taskはその間、それは場所だとして名前空間を使用しようとは、次のとおりです。

http://www.springframework.org/schema/task 

それがで宣言されているよう名前空間は、正確でなければなりませんロケーション。

関連する問題