• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

org.springframework.web.servlet.PageNotFound

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded a spring mvc hibernate integration example from the net, but could not get it to work. The error I am getting is:

org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/SpringMVCHibernate/] in DispatcherServlet with name 'appServlet'

My folder structure is attached as an image

PersonController.java


PersonDAO.java


PersonDAOImpl.java



Person.java


PersonService.java


PersonServiceImpl.java


servlet-context.xml


web.xml

save.png
[Thumbnail for save.png]
 
J Mohandos
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A silly mistake. Didn't add /persons to the url.After adding it, it works

Now I have a question. In the personController the method listPersons, editPerson use model object but other methods like addPerson and removePerson don't use model object. Why?
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
listPerson is called to list the users, so they need the model object containing the users to display in the front end, so model object is used, in case of removePerson, there is no need of model object, so they are not using it.
 
J Mohandos
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok.

There is a use of @Qualifier annotation in the controller. When I remove that, I get an error:

No qualifying bean of type [com.journaldev.spring.service.PersonService] is defined: expected single matching bean but found 2: personService,personServiceImpl

Now both personService and personService are interface and corresponding implementing class respectively. Why would it give error on that?

I can understand if there are two beans defined for the same class with different ids, but that is not the case.

 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There might be multiple beans decalred for the personservice class.. can you post us your root-context.xml file.
 
J Mohandos
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is only bean declared for personservice class

servlet-context.xml
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As i see in web.xml and the package image, i see root-context.xml inside WEB-INF/spring, I had asked for this file, Please post that.
 
J Mohandos
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing much is there in that file. Anyway, I will post it

root-context.xml
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea, then, we might have to wait for someone to help us on this.
 
J Mohandos
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please just try out the example yourself by removing and adding the @Qualifier annotation? The tutorial I am referring to is:

http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a @Service annotation on the PersonServiceImpl class. This means that spring will create an instance of PersonServiceImpl. You also have a PersonServiceImpl declared in your spring XML. THis creates another instance of PersonServiceImpl. SO, you have 2 instances of PersonServiceImpl
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic