0

我正在尝试设置spring web flow。我正在使用 spring 2.5 jar 和 swf 2.0.8 jar 这是我的配置文件:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="order" value="1" />
<属性名称="映射">
<道具>
<prop key="index.htm">indexController</prop>
</道具>
</属性>
</豆>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /> <bean name="indexController" class="org.springframework.web.servlet.mvc.ParameterizableViewController" p:viewName="index" />

<flow:flow-registry id="flowRegistry"><flow:flow-location path="/WEB-INF/flows/flow.xml"/></flow:flow-registry>

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

<bean id="flowMappings" class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="order" value="0" /> <property name="flowRegistry" ref="flowRegistry" /> </豆>

<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor" /> </豆>

当我启动服务器(tomcat 6.0)时,出现以下错误:

javax.servlet.ServletException: Servlet.init() for servlet webapp threw exception
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    java.lang.Thread.run(Thread.java:619)
root cause

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/webapp-servlet.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition(Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
    org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
    org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
    org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:158)
    org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
    org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
    org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:97)
    org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:411)
    org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:338)
    org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:332)
    org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:266)
    org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:236)
    org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
    javax.servlet.GenericServlet.init(GenericServlet.java:212)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    java.lang.Thread.run(Thread.java:619)
4

2 回答 2

2

经典原因是旧的 uber spring-all-2.0.jar 或类似的存在。

如果使用 maven 检查 mvn dependency:list 和 dependency:tree 的输出是否有不同版本的 spring jars。

于 2010-02-10T11:31:58.787 回答
1

它找不到BeanDefinitionBuilder.genericBeanDefinition(String)。此方法在 Spring 2.5 中引入

您说您使用的是 Spring 2.5,但此错误表明您实际上使用的是 2.0(或更早版本)。确保您的类路径中没有多个 Spring 副本。

于 2010-02-10T11:28:40.587 回答