?
Solved

No mapping for in DispatcherServlet with name 'spring'

Posted on 2011-05-09
18
Medium Priority
?
1,668 Views
Last Modified: 2013-11-11
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
Comment
Question by:chaitu chaitu
  • 9
  • 8
18 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35722307
there is no bean define in webflow .xml  with name of registration.

change the flowRegistry to registration
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35722402
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
 
LVL 92

Expert Comment

by:objects
ID: 35725271
I don't see any FlowController configured
0
Industry Leaders: 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!

 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725783
1)which version of spring jars should i download if i this example work?
2)how to define flowcontroller in webflow-config.xml?
0
 
LVL 92

Expert Comment

by:objects
ID: 35725800
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725889



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
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725903
ur link example also works only 1.x related jars??what jars need to placed to work for above example?
0
 
LVL 92

Expert Comment

by:objects
ID: 35725911
the example is for 1.x
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725919
yes correct.can you provide me the link for 1.x related jars?
0
 
LVL 92

Expert Comment

by:objects
ID: 35725932
I answered that in one of your earlier questions (which I think is still open)
Let me look it up for you
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725946
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
 
LVL 92

Expert Comment

by:objects
ID: 35725954
the latest 1.x uses Spring 1.2.7
0
 
LVL 92

Expert Comment

by:objects
ID: 35725957
>            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
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35725964
now i need to  download Spring 1.2.7 ??
0
 
LVL 92

Expert Comment

by:objects
ID: 35726030
the 1.2 you have should be ok
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35727953
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
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 35742648
>                               <a href="app/registration?_flowId=registration">registration</a>      

think that should just be


                              <a href="app?_flowId=registration">registration</a>      
0
 
LVL 20

Author Comment

by:chaitu chaitu
ID: 35744477
i tried this option yesterday itself and is working fine and glad that you are able to find the solution
0

Featured Post

Independent Software Vendors: 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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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
Course of the Month16 days, 2 hours left to enroll

850 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