• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1796
  • Last Modified:

No mapping for in DispatcherServlet with name 'spring'

when i click registration link i am getting below error.

May 9, 2011 10:30:25 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping for [/Ravi/app/registration] in DispatcherServlet with name 'spring'


main.jsp
**********
<HTML>
<HEAD>
<TITLE> JavaWorld Course Registration Application</TITLE>
</HEAD>
	<f:view>
		<BODY>
		   
		  	<h:form>
				<h2> 
				JavaWorld Course Registration Application 
				</h2>
					<a href="app/registration?_flowId=registration">registration</a>	
			</h:form>
		</BODY>
	</f:view>
</HTML>


web.xml
********

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<web-app 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"
   version="2.5">

  <display-name>Welcome to Tomcat</display-name>
   <description>
      Welcome to Tomcat
   </description>
 
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/webflow-config.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

 	<servlet>
		<servlet-name>spring</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
  
	<servlet-mapping>
		<servlet-name>spring</servlet-name>
		<url-pattern>/app/*</url-pattern>
	</servlet-mapping>    
 	
</web-app>


webflow-config.xml
********************

<?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:flow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

	<!-- Launches new flow executions and resumes existing executions -->
	<flow:executor id="flowExecutor" registry-ref="flowRegistry"/>
	<!--  <flow:execution-attributes>
				<flow:alwaysRedirectOnPause value="false"/>
			</flow:execution-attributes>
			<flow:execution-listeners>
				<flow:listener ref="myFlowListener" criteria="registration"/>
		</flow:execution-listeners>
	</flow:executor>
	
	<bean id="myFlowListener" class="com.citigroup.oscar.webflow.executor.jsf.FlowPhaseListener" /> -->
	<!-- Creates the registry of flow definitions for this application -->
	<flow:registry id="flowRegistry">
		<flow:location path="/WEB-INF/flows/registration.xml" />
	</flow:registry>
	
	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">   
      <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>   
      <property name="prefix" value="/jsp/"/>   
      <property name="suffix" value=".jsp"/>   
</bean> 


</beans>

registration.xml
***************
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/webflow
                          http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
                          
	<var name="UserBean" class="com.javaworld.command.UserBean" scope="flow"/>
	<var name="WebBean" class="com.javaworld.command.WebBean" scope="flow"/>
	<var name="ClassBean" class="com.javaworld.command.ClassBean" scope="flow"/>
		
	<start-state idref="enterReg" />

	<view-state id="enterReg" view="/jsp/register.jsp">
		<transition on="register" to="confirmation"/>
		<transition on="cancel" to="enterReg"/>
	</view-state>

	<view-state id="confirmation" view="/jsp/confirm.jsp">
		<transition on="revise" to="enterReg"/>
		<transition on="success" to="requiresStatus"/>
	</view-state>
	
	<decision-state id="requiresStatus">
		<if test="${flowScope.UserBean.webBased}" then="enterWebDetails" else="enterClassDetails" />
	</decision-state>

	<view-state id="enterWebDetails" view="/jsp/webdetails.jsp">
		<transition on="cancelweb" to="enterReg"/>
		<transition on="confirmweb" to="done"/>
	</view-state>	
	
	<view-state id="enterClassDetails" view="/jsp/classroom.jsp">
		<transition on="cancelclass" to="enterReg"/>
		<transition on="confirmclass" to="payment"/>
	</view-state>	
	
	<view-state id="payment" view="/jsp/payment.jsp">
		<transition on="pay" to="done"/>
		<transition on="cancel" to="enterReg"/>
	</view-state>
	<end-state id="done" view="/jsp/done.jsp"/>
	
			
	</flow>		
	

Open in new window

0
chaitu chaitu
Asked:
chaitu chaitu
  • 9
  • 8
1 Solution
 
Sathish David Kumar NArchitectCommented:
there is no bean define in webflow .xml  with name of registration.

change the flowRegistry to registration
0
 
chaitu chaituAuthor Commented:
i changed flowRegistry to registration  still same error is coming..

webflow-config.xml
********************

<?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:flow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

	<!-- Launches new flow executions and resumes existing executions -->
	<flow:executor id="flowExecutor" registry-ref="registration"/>
	<!--  <flow:execution-attributes>
				<flow:alwaysRedirectOnPause value="false"/>
			</flow:execution-attributes>
			<flow:execution-listeners>
				<flow:listener ref="myFlowListener" criteria="registration"/>
		</flow:execution-listeners>
	</flow:executor>
	
	<bean id="myFlowListener" class="com.citigroup.oscar.webflow.executor.jsf.FlowPhaseListener" /> -->
	<!-- Creates the registry of flow definitions for this application -->
	<flow:registry id="registration">
		<flow:location path="/WEB-INF/flows/registration.xml" />
	</flow:registry>
	
	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">   
      <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>   
      <property name="prefix" value="/jsp/"/>   
      <property name="suffix" value=".jsp"/>   
</bean> 


</beans>

Open in new window

0
 
objectsCommented:
I don't see any FlowController configured
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
chaitu chaituAuthor Commented:
1)which version of spring jars should i download if i this example work?
2)how to define flowcontroller in webflow-config.xml?
0
 
objectsCommented:
0
 
chaitu chaituAuthor Commented:



I am working on 1.x related examples.but in spring website am not able to find out spring 1.x related jars for botth spring and spring webflow .for example if i use 2.x or 3.x jars its not working.

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:flow="http://www.springframework.org/schema/webflow-config"
       xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/webflow-config
           http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd">

0
 
chaitu chaituAuthor Commented:
ur link example also works only 1.x related jars??what jars need to placed to work for above example?
0
 
objectsCommented:
the example is for 1.x
0
 
chaitu chaituAuthor Commented:
yes correct.can you provide me the link for 1.x related jars?
0
 
objectsCommented:
I answered that in one of your earlier questions (which I think is still open)
Let me look it up for you
0
 
chaitu chaituAuthor Commented:
spring-1.2.jar
webflow-0.6.0.jar
commons-logging-1.0.4.jar
jdom-1.0.jar

http://www.ervacon.com/products/springwebflow/index.html

i placed above jars in class path to work on 1.x example but getting below errors.


SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 9 in XML document from ServletContext resource [/WEB-INF/webflow-config.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
0
 
objectsCommented:
the latest 1.x uses Spring 1.2.7
0
 
objectsCommented:
>            http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

thats wrong version (which I think I also pointed out in a previous question :)
0
 
chaitu chaituAuthor Commented:
now i need to  download Spring 1.2.7 ??
0
 
objectsCommented:
the 1.2 you have should be ok
0
 
chaitu chaituAuthor Commented:
if i use spring 2.0.2 then the compile time errors are gone.

i defined below one in webflow-config.xml but still same error is coming.

May 10, 2011 4:46:31 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping for [/Ravi/app/registration] in DispatcherServlet with name 'spring'
<bean name="/app/*" class="org.springframework.webflow.executor.mvc.FlowController">
      <property name="flowExecutor" ref="flowExecutor"/>
</bean>
0
 
objectsCommented:
>                               <a href="app/registration?_flowId=registration">registration</a>      

think that should just be


                              <a href="app?_flowId=registration">registration</a>      
0
 
chaitu chaituAuthor Commented:
i tried this option yesterday itself and is working fine and glad that you are able to find the solution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now