Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-02-12
8
Medium Priority
?
12,908 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

877 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