找不到元素 'webflow:flow-builder-services' 的声明



我正在尝试首次将SWF集成在Spring MVC应用程序中,但是我遇到了此错误:

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException in XML document from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: XX; columnNumber: XX; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'webflow:flow-builder-services'

这是我的MVC-dispatcher-servlet.xml文件(web.xml中的ContextConfiglocation引用)

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">
<bean name="/welcome.htm" class="com.test.app.controller.MainController" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/pages/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

<!-- ================================================================== -->
<!-- Spring Web Flow stuff -->
<!-- ================================================================== -->
<bean id="viewFactoryCreator"
    class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
    <property name="viewResolvers" ref="viewResolver" />
</bean>
<webflow:flow-builder-services id="flowBuilderServices"/>

<webflow:flow-registry id="flowRegistry"
    flow-builder-services="flowBuilderServices">
    <webflow:flow-location path="/WEB-INF/flows/helloworldflow.xml" />
</webflow:flow-registry>

<webflow:flow-executor id="flowExecutor"
    flow-registry="flowRegistry">
</webflow:flow-executor>

<!-- Enables FlowHandler URL mapping -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
    <property name="flowExecutor" ref="flowExecutor" />
</bean>
<!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking 
    looks for a flow with id "hotels/booking" -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
    <property name="flowRegistry" ref="flowRegistry" />
    <property name="order" value="0" />
</bean>

我正在使用Spring 3.0.3.Release和Spring WebFlow 2.1.1.Release

您对此问题有解释吗?

预先感谢

更改您的弹簧豆模式版本。您使用的是2.5,但应为3.0。

你是对的!

这是一个不匹配的版本。当我使用SWF 2.1.1.Release

时,我还将春季WebFlow模式版本更改为http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd

ps:验证由Maven下载的Spring Jars并将其版本与在模式位置中声明的版本进行比较也很重要。(如果使用了Spring-Webflow 2.1.1,则模式位置必须声明Spring-Webflow-Config-2.0不是Spring-Webflow-Config-2.3,对于其他Spring Jars/schema声明而言)

最新更新