0

我正在尝试学习 Spring MVC 2.0 和 Spring Web Flow 1.0。

我收到以下错误(可能是当调度程序委托请求流时):

配置问题:Cannot locate BeanDefinitionParser for element [executor]

我在应用程序的构建路径中使用 Spring 2.0 和 Web Flow 1.0 jar 文件。

下面是我的 Spring MVC 2.0 配置文件:

<bean name="/phonebook.htm" 
      class="org.springframework.webflow.executor.mvc.FlowController">
    <property name="flowExecutor" ref="flowExecutor"/> 
</bean> 
<!-- Resolves flow view names to .jsp templates --> 
<bean id="viewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp">
</bean>

还有我的 Spring Web Flow 1.0 配置:

<flow:executor id="flowExecutor" registry-ref="flowRegistry"/> 
<!-- Creates the registry of flow definitions for this application --> 
<flow:registry id="flowRegistry"> <flow:location path="/WEB-INF/flows/**-flow.xml"/>
</flow:registry> 
4

2 回答 2

1

当 eclipse 将 web 应用程序部署到 tomcat 时,它还将这些 jar 文件部署到不在构建路径中的 lib 目录中。所以现在当 tomcat 执行时,它可能会找到两个用于 web 流的 jar 文件,即 webflow 1.0 和 webflow 2.0 和给我错误..即当 webflow 的两个不同版本的 jar 文件在 lib 目录中时。

我还要感谢 skaffman 的支持。

于 2010-04-06T06:13:40.653 回答
0

好的,所以看起来问题出<flow:executor>在您的 webflow 配置中的元素上。Spring 抱怨它不明白这意味着什么,这可能是因为您缺少配置文件中的命名空间声明。这看起来像这样:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:flow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

您的根元素必须看起来像这样。请参阅此处的文档。

于 2010-04-05T10:58:41.363 回答