Announcement Announcement Module
Collapse
No announcement yet.
Spring 2.5.6 annotation mapping not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 2.5.6 annotation mapping not working

    I am trying to implement Spring MVC using Annotations and I am getting below warnings

    HTML Code:
    14:43:00,573 INFO  [STDOUT] 14:43:00,573 WARN  [PageNotFound] No mapping found for HTTP request with URI [/CreditCard/start.do] in DispatcherServlet with name 'dispatcher'
    Version: Spring 2.5.6.SEC02

    The url : http://localhost:8080/CreditCard/start.do

    The following are the configuration files:

    Web.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/spring-*.xml 
    		</param-value>
    	</context-param>
    	<context-param>
    		<param-name>contextClass</param-name>
    		<param-value>org.jboss.spring.vfs.context.VFSXmlWebApplicationContext</param-value>
    	</context-param>
    	
    	<servlet>
    		<servlet-name>dispatcher</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>dispatcher</servlet-name>
    		<url-pattern>*.do</url-pattern>
    	</servlet-mapping>
    
    </web-app>

    dispatcher-servlet.xml


    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:webflow="http://www.springframework.org/schema/webflow-config"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://www.springframework.org/schema/tx 
       http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/webflow-config  
       http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd">
    
        	<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />	
        
    	<context:component-scan base-package="com.ui.ccp.controller.web" />
    	<context:annotation-config />
    	<tx:annotation-driven/>
    	
       <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
      <bean	class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
    
    
    <bean id="viewResolver"
    		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="viewClass"
    			value="org.springframework.web.servlet.view.JstlView" />
    		<property name="prefix" value="/WEB-INF/jsp/" />
    		<property name="suffix" value=".jsp" />
    	</bean>
                             
    
    </beans>

    The controller class


    Code:
    package com.ui.ccp.controller.web;
    
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    
     
    @Controller
    public class CreditCardController {
    	
    	@RequestMapping("/start.do")
        public void indexHandler() {
    	//	String principalId = (String) request.getParameter("principalId");
    		System.out.println("In the method ");
        }
        
        @RequestMapping("/about.do")
        public void aboutHandler() {
        }
        
        @RequestMapping("/admin.do")
        public void adminHandler() {
        }
    
    }
    I have been searching and trying out from morning with no result. I really appreciate if anyone can help me!!! We cannot upgrade to Spring 3.0 as we have other projects which are developed using Spring 2.5. So, please help!
Working...
X