2011-09-27 160 views
0

我有这样一个错误的Webflow与和2.3.0.RELEASE RichFaces的4.0.0.Final工作在JBoss中7.0.1.FINAL:错误嵌套的例外是org.springframework.beans.factory.NoSuchBeanDefinitionException Webflow的

12:16:46,989 INFO [stdout](MSC服务线程1-7)2011-09-20 12:16:46,987 [MSC服务线程1-7] ERROR(FrameworkServlet.java:314)上下文初始化失败12:16:46,989信息[标准输出](MSC服务线程1-7)org.springframework.beans.factory.BeanCreationException:创建名为'flowExecutor'的bean时出错:无法创建类型为[ org.springframework.webflow.config.FlowExecutionListenerLoaderFactoryBean],同时设置bean属性'flowExecutionListenerLoader';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'(内部bean)#1'的bean时出错:无法在设置bean属性'listeners'时解析对bean'jpaFlowExecutionListener'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/spring/transportes-webflow.xml]中定义的名称为'jpaFlowExecutionListener'的Bean创建时出错:设置时无法解析对bean'entityManagerFactory'的引用构造参数;嵌套异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有定义名为'entityManagerFactory'的bean。

嗯,我想该错误是因为我有在META-INF休眠configuracion这样的:

  • META-INF /弹簧/弹簧master.xml
    • META -INF /弹簧/弹簧hibernate.xml
    • META-INF /弹簧/弹簧datasource.xml
    • META-INF /弹簧/ jdbc.properties

和WEB-INF的Webflow的配置: WEB-INF /春/ TRANSPORTES-webflow.xml

<?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:webflow="http://www.springframework.org/schema/webflow-config" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:faces="http://www.springframework.org/schema/faces" 
    xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/webflow-config 
    http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd 
    http://www.springframework.org/schema/faces 
    http://www.springframework.org/schema/faces/spring-faces-2.0.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

<!--Flow executor for Jpa integration and security --> 
<webflow:flow-executor id="flowExecutor"> 
    <webflow:flow-execution-listeners> 
     <webflow:listener ref="securityFlowExecutionListener"/> 
     <webflow:listener ref="jpaFlowExecutionListener"/> 
    </webflow:flow-execution-listeners> 
</webflow:flow-executor> 

<!-- Flow register --> 
<webflow:flow-registry flow-builder-services="facesFlowBuilderServices" 
         id="flowRegistry" base-path="/WEB-INF/flows/"> 
    <!-- <webflow:flow-location path="/welcome/welcome.xml"/> --> 
    <webflow:flow-location-pattern value="/**/*-flow.xml"/> 
</webflow:flow-registry> 

<faces:flow-builder-services id="facesFlowBuilderServices" 
          enable-managed-beans="true" development="true"/> 

<!-- For use interface flow controller --> 
<bean 
     class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/> 

<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> 
    <property name="flowExecutor" ref="flowExecutor"/> 
    <!-- need to tell Spring Web Flow about how to handle Ajax requests. --> 
    <property name="ajaxHandler"> 
     <bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler" /> 
    </property> 
</bean> 

<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> 
    <property name="flowRegistry" ref="flowRegistry"/> 
    <property name="defaultHandler"> 
     <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/> 
    </property> 
</bean> 

<!-- LISTENER'S for SECURITY and JPA--> 
<bean id="securityFlowExecutionListener" 
     class="org.springframework.webflow.security.SecurityFlowExecutionListener"/> 

<bean id="jpaFlowExecutionListener" 
     class="org.springframework.webflow.persistence.HibernateFlowExecutionListener"> 
    <constructor-arg ref="entityManagerFactory"/> 
    <constructor-arg ref="transactionManager"/> 
</bean> 

<!-- Facelets config --> 
<bean id="faceletsViewResolver" 
     class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
    <property name="viewClass" value="org.springframework.faces.mvc.JsfView"/> 
    <property name="prefix" value="/WEB-INF/flows/"/> 
    <property name="suffix" value=".xhtml"/> 
</bean> 

这是我的全部提示下载:

https://rapidshare.com/files/335929555/prompt-jboss.zip

感谢

回答

0
NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined 

意味着它无法找到一个bean定义为entityManagerFactory。从你的Webflow配置它是需要通过jpaFlowExecutionListener

<bean id="jpaFlowExecutionListener" 
    class="org.springframework.webflow.persistence.HibernateFlowExecutionListener"> 
    <constructor-arg ref="entityManagerFactory"/> 
    <constructor-arg ref="transactionManager"/> 
</bean> 

如果这个bean的定义:

META-INF/spring/spring-hibernate.xml 

它应当通过一个Webflow的配置(WEB-INF/spring/transportes-webflow.xml

<import resource="classpath:META-INF/spring/spring-hibernate.xml" /> 
进口

或者确保你的Web配置监听器中有这两个文件:

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath:META-INF/spring/spring-hibernate.xml /WEB-INF/spring/transportes-webflow.xml ... </param-value> 
</context-param> 

<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 
相关问题