Hi,
I encountered this error message when the application tried to load the flows and views from classes/META-INF:
Both flow.xml and user.xhtml are under classes/META-INF/user. If I move them to WEB-INF/flows, everything works okay.Code:java.lang.IllegalStateException: A ContextResource is required to get relative view paths within this context; the resource was file [/Users/wolf/Development/Workspace/webproject/target/classes/META-INF/user/user.xhtml]
Here is my web.xml configuration:
Here is my webContext.xml configuration:Code:<web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:*Context.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <filter> <filter-name>security</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetBeanName</param-name> <param-value>springSecurityFilterChain</param-value> </init-param> </filter> <filter-mapping> <filter-name>security</filter-name> <servlet-name>mvc</servlet-name> <url-pattern>/*</url-pattern> </filter-mapping> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>1</param-value> </context-param> <context-param> <param-name>javax.faces.FACELETS_LIBRARIES</param-name> <param-value>/WEB-INF/springsecurity.taglib.xml</param-value> </context-param> <context-param> <param-name>facelets.VIEW_MAPPINGS</param-name> <param-value>*.xhtml</param-value> </context-param> <context-param> <param-name>facelets.RESOURCE_RESOLVER</param-name> <param-value>org.springframework.faces.webflow.Jsf2FlowResourceResolver</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> <servlet> <servlet-name>mvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value></param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc</servlet-name> <url-pattern>/app/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
Please help. Thank you.Code:<beans> <mvc:annotation-driven /> <mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/resources/"/> <bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/> <bean id="securityListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" /> <bean id="primeRenderListener" class="org.springframework.faces.primefaces.PrimeRenderFragmentsListener"/> <faces:flow-builder-services id="flowBuilderServices" development="true" /> <faces:resources/> <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="classpath*:/META-INF/"> <webflow:flow-location id="parent-flow" path="parent-flow.xml"/> <webflow:flow-location-pattern value="/**/flow.xml" /> </webflow:flow-registry> <webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"> <webflow:flow-execution-listeners> <webflow:listener ref="facesContextListener"/> <webflow:listener ref="securityListener"/> <webflow:listener ref="primeRenderListener"/> </webflow:flow-execution-listeners> </webflow:flow-executor> <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="flowRegistry" ref="flowRegistry" /> </bean> <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter"> <property name="flowExecutor" ref="flowExecutor" /> </bean> <bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass" value="org.springframework.faces.mvc.JsfView" /> <property name="prefix" value="/WEB-INF/views/" /> <property name="suffix" value=".xhtml" /> </bean> </beans>
Best Regards


Reply With Quote