2017-10-10 62 views
2

Spring Framework 4.0.6으로 웹 응용 프로그램을 작성하고 있습니다. 동시에 일상적으로 운영되는 작은 루틴을 예약하십시오. @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 
그것이 선언대로 네임 스페이스는 정확히해야합니다

위치.