Solved

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

Posted on 2014-02-12
8
11,450 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

623 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