Announcement Announcement Module
Collapse
No announcement yet.
No Mapping Found for HTTP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • No Mapping Found for HTTP

    I am using the latest spring 3.0.5.RELEASE. Everytime i try to access the page i get the error :-

    PageNotFound [WARN] No mapping found for HTTP request with URI [/user/math/foo/111] in DispatcherServlet with name 'user'

    Below is my web.xml and *-servlet.xml and the controller. Can someone please tell me why my page is not loading ?

    The URI which i am using is :-

    http://localhost:8080/user/math/foo/111

    Also my jsp userView.jsp is under /WEB-INF/userView.jsp

    Code:
    Controller
    public class UserController {
            
        @Autowired
        private UserService userService;
        
        @RequestMapping(value="/{className}/{name}/{number}", method=RequestMethod.GET )
        public ModelAndView displayUserInfo(@PathVariable("className")String className,@PathVariable("name") String name, @PathVariable("number")String number) {
            ModelAndView mav = new ModelAndView("userView");
                    mav.addObject("classRoom", userService.getUserInfo(className, name, number));
            return mav;
        }
    
    }
    
    user-servlet.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans default-lazy-init="false"
    	xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:spring="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"  
    	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
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
    
    
    	<context:component-scan base-package="com.foo.rest*">
    	</context:component-scan>
    	<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    		<property name="alwaysUseFullPath" value="false"/>
    	</bean>
    
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" />
    
    	<bean id="contentNegotiatingViewResolver" class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
    		<property name="mediaTypes">
    			<map>
    				<entry key="html" value="text/html" />
    			</map>
    		</property>
    		<property name="viewResolvers">
    			<list>
    				<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
    				<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    					<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
    					<property name="prefix" value="/WEB-INF/jsp/" />
    					<property name="suffix" value=".jsp" />
    				</bean>
    			</list>
    		</property>
    	</bean>
    
    web.xml
    
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	version="2.4"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    	<display-name>users</display-name>
    	<description>users</description>
    
    	<context-param>
    		<param-name>log4jConfigLocation</param-name>
    		<param-value>classpath:log4j.properties</param-value>
    	</context-param>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
                classpath:troublecode-servlet.xml
            </param-value>
    	</context-param>
    	
    	<listener>
    		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    	</listener>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<servlet>
    		<servlet-name>user</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value />
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>user</servlet-name>
            <url-pattern>/</url-pattern>
    	</servlet-mapping>
    
    
    	<welcome-file-list>
    		<welcome-file>index.jsp</welcome-file>
    	</welcome-file-list>
    
    </web-app>

  • #2
    Never mind i solved it.

    Comment

    Working...
    X