【问题标题】:Cannot locate BeanDefinitionParser for element [executor]找不到元素 [执行程序] 的 BeanDefinitionParser
【发布时间】:2015-02-28 23:59:19
【问题描述】:

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

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

配置问题:找不到元素 [executor] 的 BeanDefinitionParser

我在应用程序的构建路径中使用 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> 

【问题讨论】:

  • 首先,我们需要更多的信息,比如查看您的配置。此外,Spring 2.0 和 Webflow 1.0 都非常老了。如果您刚开始使用这些东西,那么您应该使用最新版本。
  • Spring 2.0 配置文件..
  • Spring webflow 1.0 配置文件。

标签: spring spring-mvc spring-webflow


【解决方案1】:

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

我还要感谢 skaffman 的支持..

【讨论】:

    【解决方案2】:

    好的,看来问题出在您的 webflow 配置中的 &lt;flow:executor&gt; 元素上。 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">
    

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

    【讨论】:

    • 实际上我无法发布这个命名空间,所以我只发布了内部配置部分。实际上我确实有相同的命名空间......但它没有工作......
    • @Yogi:错误消息表明,否则,您可能在那里得到了一些不太正确的东西。请编辑您的问题并粘贴两个配置文件的全部内容。
    猜你喜欢
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多