Announcement Announcement Module
Collapse
No announcement yet.
MVC + JSF2: org.springframework.web.servlet.DispatcherServlet noHandlerFound Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MVC + JSF2: org.springframework.web.servlet.DispatcherServlet noHandlerFound

    I have attempted to combine MVC and JSF2 using the demo application booking-faces as my model (without flows and security for the time being). Configuration is copied from the demo application. Here are the relevant bits:

    Relevant bits of web.xml
    Code:
    <!-- The front controller of this Spring Web application, responsible for handling all application requests -->
    <servlet>
    	<servlet-name>Spring MVC Dispatcher Servlet</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>2</load-on-startup>
    </servlet>
    		
    <!-- Map all /spring requests to the Dispatcher Servlet for handling -->
    <servlet-mapping>
    	<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    	<url-pattern>/spring/*</url-pattern>
    </servlet-mapping>
    	<!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
    <servlet>
    	<servlet-name>Faces Servlet</servlet-name>
    	<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    	<load-on-startup>1</load-on-startup>
    </servlet>
    	
    <!-- Just here so the JSF implementation can initialize -->
    <servlet-mapping>
    	<servlet-name>Faces Servlet</servlet-name>
    	<url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    Configuration web-application-config.xml is like in the demo application except that flow, data access and security definitions are commented out.
    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:context="http://www.springframework.org/schema/context"
           xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    	 <context:component-scan base-package="com.ourcompany.poc"/>
    
    	<!-- Imports the configurations of the different infrastructure systems of the application -->
    	<import resource="webmvc-config.xml" />
    	<!-- import resource="webflow-config.xml" / -->
    	<!-- import resource="data-access-config.xml" / -->
    	<!-- import resource="security-config.xml" / -->
    </beans>
    File webmvc-config.xml is exactly as in the demo application:
    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:faces="http://www.springframework.org/schema/faces"
           xsi:schemaLocation="
           	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
           	http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
    
    	<faces:resources />
    
    	<!-- 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" />
    	</bean>
    
    	<!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations -->
    	<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
    
    </beans>
    In http://richweb.springsource.org/swf-...s/spring/login login is resolved to login.xhtml and somehow handled by some controller. When I run my demo application at url http://localhost:8080/demo/spring/default, I get
    Code:
    july 17, 2013 1:49:57 IP. org.springframework.web.servlet.DispatcherServlet noHandlerFound
    WARNING: No mapping found for HTTP request with URI [/demo/spring/default] in DispatcherServlet with name 'Spring MVC Dispatcher Servlet'
    All the discussions regarding noHandlerFound seem to focus on a missing controller. However, I do not see any @Controller or @RequestMapping definitions in the demo application and still a handler is found. What am I missing here?
Working...
X