Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

No mapping found for HTTP request with URI in DispatcherServlet with name 'dispatcher'

Posted on 2014-02-12
8
Medium Priority
?
12,158 Views
Last Modified: 2014-02-21
Hi,

I am  getting an error while running the application, I am using jboss 7.1

what is the issue


11:27:13,409 WARN  [org.springframework.web.servlet.PageNotFound] (http-localhost-127.0.0.1-8000-1) No mapping found for HTTP request with URI [/SpringExample11/userRegistration.htm] in DispatcherServlet with name 'dispatcher'

Here is my web.xml
<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>SpringExample11</display-name>
  <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>*.htm</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>redirect.jsp</welcome-file>
    </welcome-file-list>
</web-app>

Open in new window



 <?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /> 
  <bean id="userService" class="com.vaannila.service.UserServiceImpl" /> 
  <context:component-scan base-package="com.vaannila.web" /> 
  <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" /> 
  <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> 
  </beans>

Open in new window

0
Comment
Question by:roy_sanu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 39855418
check whether userRegistration.htm exists or not in SpringExample11.war directory.
0
 

Author Comment

by:roy_sanu
ID: 39855428
it is working tomcat 7 but not with Jboss 7, what might be the reason
0
 
LVL 36

Expert Comment

by:mccarl
ID: 39855721
I think the difference between Tomcat and JBoss is in the way the app is getting deployed. If this is the url that you are currently using...

http://localhost:8000/SpringExample11/userRegistration.htm

...then try the following instead...

http://localhost:8000/userRegistration.htm



If this isn't the problem, then can you please post the code for your Spring controller class?
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

by:roy_sanu
ID: 39855745
No, it is not working with the above url, same error

Here is the piece of controller code...........
@Controller
@RequestMapping("/userRegistration.htm")
@SessionAttributes("user")
public class UserController {

	private UserService userService;

	@Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	@RequestMapping(method = RequestMethod.GET)
	public String showUserForm(ModelMap model)
	{
		User user = new User();
		model.addAttribute(user);
		return "userForm";
	}

	@RequestMapping(method = RequestMethod.POST)
	public String onSubmit(@ModelAttribute("user") User user) {
		userService.add(user);
		return "redirect:userSuccess.htm";
	}
	
}

Open in new window

0
 
LVL 36

Expert Comment

by:mccarl
ID: 39855969
Can you post the full logs, including before the error message. Spring should have logged what controllers it found and their request mappings which should help debug why it can't find this one.
0
 

Author Comment

by:roy_sanu
ID: 39856713
22:50:41,455 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 125162ms - Started 222 of 299 service
s (76 services are passive or on-demand)
22:50:42,105 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "SpringExample11.war"
23:01:36,891 WARN  [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-1) No mapping found for HTTP request with URI [/SpringExample1
1/userRegistration.htm] in DispatcherServlet with name 'dispatcher'
23:01:57,812 WARN  [org.springframework.web.servlet.PageNotFound] (http--127.0.0.1-8080-1) No mapping found for HTTP request with URI [/SpringExample1
1/userRegistration.htm] in DispatcherServlet with name 'dispatcher'

Open in new window



In the redirect.jsp page

%@page contentType="text/html" pageEncoding="UTF-8"%>
<% response.sendRedirect("userRegistration.htm"); %>

Open in new window

0
 

Accepted Solution

by:
roy_sanu earned 0 total points
ID: 39862984
Added BeanNameUrlHandlerMapping it is working fine...............
	<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>

		<bean name="/userRegistration.htm" class="com.vaannila.web.UserController" />
	<bean name="/userSuccess.htm" class="com.vaannila.web.UserSuccessController" />
	

Open in new window


thanks
0
 

Author Closing Comment

by:roy_sanu
ID: 39876318
This is working fine now..........
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question