Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Spring webMVC - org.springframework.web.servlet.DispatcherServlet noHandlerFound

 
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using the following example:


web.xml



application-config.xml



WelcomeController.java




when i am typing this url in browser http://localhost:8080/mvcdemoapp/helloWorld

i am getting the below error:

Mar 4, 2010 3:08:21 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound

WARNING: No mapping found for HTTP request with URI [/mvcdemoapp/helloWorld] in DispatcherServlet with name 'example'



Please some body guide me what is wrong with the above code.
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that a correct URL pattern? Do you need an "*"?

<servlet-mapping>
<servlet-name>example</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

Mark
 
author
Posts: 396
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Mark's right...the path should probably be "/*"
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Craig Walls wrote:I think Mark's right...the path should probably be "/*"




I changed it and still not working..

Here is the tomcat log:

Mar 5, 2010 10:53:22 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_15\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\IBM\WebSphere MQ\Java\lib;D:\oracle\product\10.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\IBM\Trace Facility;C:\Program Files\Personal Communications;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Windows Imaging\;C:\Program Files\IBM\WebSphere MQ\bin;C:\Program Files\IBM\WebSphere MQ\tools\c\samples\bin;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Java\jdk1.6.0_12\bin;C:\Program Files\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar;C:\Program Files\jakarta-tomcat-5.0.28\common\lib\jsp-api.jar;.;C:\ANT\apache-ant-1.7.1\bin;C:\Program Files\CollabNet Subversion Client;C:\Program Files\glassfish-v2ur2\javadb\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\Program Files\Apache Software Foundation\apache-maven-2.2.1\apache-maven-2.2.1\bin;C:\Documents and Settings\149955\Desktop\gwt-windows-1.7.0\gwt-windows-1.7.0
Mar 5, 2010 10:53:22 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:mvcdemoapp' did not find a matching property.
Mar 5, 2010 10:53:23 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Mar 5, 2010 10:53:23 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2021 ms
Mar 5, 2010 10:53:23 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 5, 2010 10:53:23 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Mar 5, 2010 10:53:24 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'example'
Mar 5, 2010 10:53:24 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'example': initialization started
Mar 5, 2010 10:53:24 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'example-servlet': startup date [Fri Mar 05 10:53:24 GMT+05:30 2010]; root of context hierarchy
Mar 5, 2010 10:53:24 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/application-config.xml]
Mar 5, 2010 10:53:25 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@149d886: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor]; root of factory hierarchy
Mar 5, 2010 10:53:27 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'example': initialization completed in 3406 ms
Mar 5, 2010 10:53:27 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Mar 5, 2010 10:53:27 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 5, 2010 10:53:27 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/47 config=null
Mar 5, 2010 10:53:27 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4862 ms
Mar 5, 2010 10:54:13 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/mvcdemoapp/helloWorld] in DispatcherServlet with name 'example'




and it is my POM.xml





What might be the problem?
 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@149d886: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor];


above log suggest bean for WelcomeController is not created.

Also logs for registering handler are missing.

May be your WelcomeController class package and component-scan base-package in application-context.xml are different.

<context:component-scan base-package="com.mvcdemoapp"></context:component-scan>


Both should be exactly same.

Thanks.
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kuldeep Yadav wrote:Hi,

INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@149d886: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,
org.springframework.context.annotation.internalAutowiredAnnotationProcessor,
org.springframework.context.annotation.internalRequiredAnnotationProcessor,
org.springframework.context.annotation.internalCommonAnnotationProcessor];


above log suggest bean for WelcomeController is not created.

Also logs for registering handler are missing.

May be your WelcomeController class package and component-scan base-package in application-context.xml are different.

<context:component-scan base-package="com.mvcdemoapp"></context:component-scan>


Both should be exactly same.

Thanks.



Kuldeep, Thanks for your reply..

the package of WelcomeController.java and base-package value in application-config.xml is same.

I have spent whole day to find out the problem but no success..I am really going mad...Any help guys....
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out that after i deployed the application in tomcat, The C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\mvcdemoapp\WEB-INF\classes\com\mvcdemoapp is empty...

I think it is supposed to have class file of WelcomeController.java..

what i am doing wrong?

I am using maven plugin for eclipse.

I am exporting the war file of the project to webapps folder of tomcat and running tomcat again.


Some body help me
 
Kuladip Yadav
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sudhakar,

If it is originally maven project then first convert it into eclipse WTP project
using :

And then import project in eclipse and try again.

Hopefully, it will work for you.

Thanks.
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I found out the problem..the war file i am deploying in tomcat does not have class file of welcomecontroller.java

This happened because i am running maven commands in one location and my eclipse changes happening in one location..

at last i resolved this..

thanks guys..
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!