• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No mapping found for HTTP request with URI - Why erreur404

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm starting to learn spring and for this i tried the hello world.
Unfortunately i've an error404 when i attempt to load my hello.jsp

here is my pom.xml:


my web.xml


my spring-servlet.xml


my controller:


here is my index.jsp thant can call hello.jsp


So when i click on the link i've an error404 and the console return this:
No mapping found for HTTP request with URI [/tutoSpringMavenHibernate/hello.html] in DispatcherServlet with name 'spring'

thanks for your help
 
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change to
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've already tested this but still the same error
 
Kr. Pallav
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add
to xml and check if your jsp hello.jsp is inside WEB-INF/jsp folder
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

i added the line : <context:annotation-config />
before the line: <context:component-scan base-package="com.tutoSpringMavenHibernate.controller" /> in my spring-servlet.xml

My page hello.jsp is well under WEB-INF/jsp
If i try to load it with welcome-file in web.xml it works

Somebody has an other idea :-s

thanks for your help
 
Kr. Pallav
Ranch Hand
Posts: 32
Netbeans IDE Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In web.xml


Change is
<url-pattern>*.html</url-pattern>
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
unfortunately it doesn't work again :-(

Does it come from my dependencies in my pom?
still again the error404

thanks and hope makes it work
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm really disapointed with this error :-s

Nobody has a solution to make it works or a tutorial

thanks
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a couple problems. You are creating the context twice once for the webcontext (defaults to servletName-servlet.xml if you don't have it defined) and you are defining a root context using the same configuration.

Take a look at this:



In the example I have explicitly defined the name of the dispatcher servlet context. If I don't do that it will look using the convention I explained above. In your case you are using the exact same configuration for creating 2 contexts. Either use 2 separate ones and leave your root-context empty for now or you can opt out of having to have a separate servlet context by leaving the tag empty like this



Also add this to your spring.xml config file (including the mvc namespace at the top)


finally make sure you are accessing it using the correct context root. (don't include the context root as part of your mapping in your controller handler as someone else already mentioned)
 
Bill Gorder
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also you can remove



it is unnecessary if you are using component scan.
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot for your explanation.


i tested but i've always the same error404 :-s

here is my new web.xml:


my spring-servlet.xml under WEB-INF/spring/appServlet


my root-context.xml under WEB-INF/spring


my index.jsp under the root path and my hello.sp under WEB-INF/jsp
I call it from index.jsp on calling it with: <a href="hello.html">Say Hello</a>

finally here is my controller:


What is my mistake? i'm a php developer and it's really difficult to me to understand.

thans for your helps
 
fabian verbeek
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it should come an issue with maven or eclipse because i tried without maven and in including the necessary jar in lib folder of tomcat it works.

Here is the lib i used:
commons-logging.jar
org.springframework.asm-3.1.2.RELEASE.jar
org.springframework.beans-3.1.2.RELEASE.jar
org.springframework.context-3.1.2.RELEASE.jar
org.springframework.core-3.1.2.RELEASE.jar
org.springframework.expression-3.1.2.RELEASE.jar
org.springframework.web.servlet-3.1.2.RELEASE.jar
org.springframework.web-3.1.2.RELEASE.jar
javax.servlet.jsp.jstl-1.2.1.jar

thanks for your helps
 
Oh. Hi guys! Look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic