Announcement Announcement Module
Collapse
No announcement yet.
Webflow configuration for JSF 2, Richfaces 4 and SWF integration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webflow configuration for JSF 2, Richfaces 4 and SWF integration

    I am upgrading a website built in webflow, jsf 1.2 and Richfaces 3.3.3 running on Glassfish 2.1 to webflow, JSF 2 and RichFaces 4 running on Glassfish 3.1
    my configuration files are as shown below, however I have url mapping issues now. my pages (*.xhtml) are stored in WEB-INF\flows\subscribe, but the SWF try to resolve the url with JNDI.

    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns="http://java.sun.com/xml/ns/javaee"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    	version="2.5">
    	<display-name>Generic Telematics Enrollment</display-name>
    	<distributable />
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>classpath:/app-config.xml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    		<param-value>.xhtml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
    		<param-value>*.xhtml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>facelets.REFRESH_PERIOD</param-name>
    		<param-value>1</param-value>
    	</context-param>
    
    	<!-- Loading the RichFaces Static information -->
    	<context-param>
    		<param-name>org.richfaces.LoadStyleStrategy</param-name>
    		<param-value>DEFAULT</param-value>
    	</context-param>
    	<context-param>
    		<param-name>org.richfaces.LoadScriptStrategy</param-name>
    		<param-value>DEFAULT</param-value>
    	</context-param>
    
    	<context-param>
    		<param-name>org.richfaces.skin</param-name>
    		<param-value>blueSky</param-value>
    	</context-param>
    
    	<filter>
    		<filter-name>charEncodingFilter</filter-name>
    		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    		<init-param>
    			<param-name>encoding</param-name>
    			<param-value>UTF-8</param-value>
    		</init-param>
    		<init-param>
    			<param-name>forceEncoding</param-name>
    			<param-value>true</param-value>
    		</init-param>
    	</filter>
    	<filter-mapping>
    		<filter-name>charEncodingFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    	<listener>
    		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    	</listener>
    
    	<servlet>
    		<servlet-name>Resources Servlet</servlet-name>
    		<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
    		<load-on-startup>0</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>Resources Servlet</servlet-name>
    		<url-pattern>/resources/*</url-pattern>
    	</servlet-mapping>
    	<servlet>
    		<servlet-name>frontController</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>/WEB-INF/spring/webmvc-config.xml</param-value>
    		</init-param>
    		<load-on-startup>2</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>frontController</servlet-name>
    		<url-pattern>/page/*</url-pattern>
    	</servlet-mapping>
    	<servlet>
    		<servlet-name>facesLoader</servlet-name>
    		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>facesLoader</servlet-name>
    		<url-pattern>*.faces</url-pattern>
    	</servlet-mapping>
    	<servlet-mapping>
    		<servlet-name>facesLoader</servlet-name>
    		<url-pattern>*.jsf</url-pattern>
    	</servlet-mapping>
    	<welcome-file-list>
    		<welcome-file>index.html</welcome-file>
    	</welcome-file-list>
    </web-app>
    webmvc-config.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    
    	<!-- Maps request URIs to controllers -->
    	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="mappings">
    			<value>
    				/subscribe=flowController
                                    /javax.faces.resource/**=richfacesResourceHandler
                                    /rfRes/**=richfacesResourceHandler
    			</value>
    		</property>
    		<property name="order" value="0" />
    		<property name="interceptors">
    			<list>
    				<ref bean="localeChangeInterceptor" />
    			</list>
    		</property>
    		<property name="defaultHandler">
    			<!-- Selects view names to render based on the request URI: e.g. /main 
    				selects "main" -->
    			<bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
    		</property>
    	</bean>
    
    	<bean name="richfacesResourceHandler"
    		class="org.springframework.faces.webflow.JsfResourceRequestHandler" />
    	<!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' 
    		to '/WEB-INF/search.xhtml' -->
    	<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/" />
    		<property name="suffix" value=".xhtml" />
    		<property name="order" value="1" />
    	</bean>
    
    	<!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller 
    		implementations -->
    	<bean
    		class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    
    
    	<bean id="localeChangeInterceptor"
    		class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
    		<property name="paramName" value="langPref" />
    	</bean>
    	<bean id="localeResolver"
    		class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
    
    	<import resource="webflow-config.xml" />
    
    </beans>
    webflow-config.xml
    Code:
    <?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:faces="http://www.springframework.org/schema/faces"
    	xmlns:context="http://www.springframework.org/schema/context"
    	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.0.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">
               
    	<context:annotation-config/>
    	<context:component-scan base-package="com.company" />
    
    	<bean id="facesContextListener"
    		class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />
    	<!-- Executes flows: the central entry point into the Spring Web Flow system -->
    	<webflow:flow-executor id="flowExecutor">
    		<webflow:flow-execution-listeners>
    			<webflow:listener ref="facesContextListener" />
    			<!--<webflow:listener ref="securityFlowExecutionListener"/> -->
    		</webflow:flow-execution-listeners>
    	</webflow:flow-executor>
    
    
    	<!-- The registry of executable flow definitions -->
    	<webflow:flow-registry id="flowRegistry"
    		flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows">
    		<webflow:flow-location-pattern value="/**/*-flow.xml" />
    	</webflow:flow-registry>
    
    	<!-- Configures the Spring Web Flow JSF integration -->
    	<faces:flow-builder-services id="facesFlowBuilderServices"
    		development="true" />
    
    
    	<!-- Installs a listener to apply Spring Security authorities -->
    	<!--<bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" 
    		/> -->
    	<bean id="scopeRegistrar" class="org.springframework.webflow.scope.ScopeRegistrar" />
    
    	<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
    		<property name="flowExecutor" ref="flowExecutor" />
    		<!-- Integrates the ability to use RichFaces Ajax components -->
    		<property name="ajaxHandler">
    			<bean class="org.springframework.faces.webflow.JsfAjaxHandler" />
    		</property>
    	</bean>
    </beans>

    HTTP Status 500
    type Exception report

    message

    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.springframework.web.util.NestedServletExceptio n: Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutio nException: Exception thrown in state 'registration' of flow 'subscribe'
    root cause
    org.springframework.webflow.execution.FlowExecutio nException: Exception thrown in state 'registration' of flow 'subscribe'
    root cause
    javax.faces.FacesException: Error Checking Last Modified for jndi:/server/enrollment/registration.xhtml
    root cause
    java.io.FileNotFoundException

  • #2
    Hi man, i have the same error, the only difference is i'm using jboss 7 and primefaces instead of glassfish + richfaces, did you find a way to solve it ?

    Comment

    Working...
    X