• 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 [/springmvc/login.do] in DispatcherServlet

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends

I'm getting this error

No mapping found for HTTP request with URI [/springmvc/login.do] in DispatcherServlet with name 'dispatcher'.

my web.xml file


------------------------------------------------------------------------------------------------------------------------------------------------------------------------
my dispatcher-servlet.xml

----------------------------------------------------------------------------------------------------------------------------------------
my spring-business-context.xml

----------------------------------------------------------------------------------------------------------------------------------------------------------
my Controller class

Kindly help me
Regards
 
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just curious, does .html work?
 
Brajesh Choudhary
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi Ken

First I use *.html but after that I use *.do extension but it also not work for me as you see in my files.

 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brajesh Choudhary wrote:
First I use *.html but after that I use *.do extension but it also not work for me as you see in my files.



Hum... If you only use one, does it work? i.e. just have the single servlet-mapping entry. Also can't you do multiple url-pattern entries inside of the servlet-mapping? Perhaps having two mappings screws it up.

Have you tried /login.do instead of login.do? i.e. putting the path in first?

Also, have you tried path-based mapping? If you're on Spring 3.0.6 or higher you could literally use /* for the URL mapping, coupled with the <mvc:resources /> tag that describes where the non-JSP resources reside...

Otherwise in earlier versions you could use /controllers/* or something like that. Then in your UrlMapping you could use "/controllers/foo" and it would map. Generally path-based mapping seems to be a 'best practice' these days.
 
Brajesh Choudhary
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ken

I don't know how but yesterday code works today but i get a new problem today while integrating hibernate with my spring project.

Here is stack Trace


my spring-business-context.xml


my hibernate.cfg.xml file


my datasource.xml


This is a maven project so I here providing my pom.xml


 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First question - why are you mounting both a Session Factory AND a JPA Entity Manager Factory?

You only really need the Entity Manager Factory.

You should be able to use the hbm.xml files if you use Hibernate as a provider. Apparently they will be picked up automatically when you use the Hibernate EntityManager (which you'll use in your persistence.xml file as your provider). See http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html for details on that, specifically 2.2.1.

I haven't done the hbm.xml mappings as part of a JPA 2 application, but I think it should be possible as long as you use the entity manager.

I am wondering if you want to use the container's Entity Manager. It's not needed in Spring, you could be using the LocalContainerEntityManagerFactoryBean - which is app server independent. While I would think the connection pool could be fetched from a Java EE datasource in JNDI, there is no practical benefit to using the container's entity manager that I can see and you make your application slightly less portable (you could run it on Tomcat or Jetty with the Spring one). Try setting up just these things:

- a Spring LocalContainerEntityManagerFactoryBean that sets up your JPA container
- a Spring JNDI DataSource - inject it into the bean above
- a JTA transaction manager - which you currently have commented out

That's all you really need. Make sure you include core hibernate as well as the hibernate entity manager, and you're on your way. Maybe a JBoss / Hibernate / Spring person will set me straight on this though (please do as I've not done that specific config myself).

I believe it's possible your class not found exception is coming from the fact that you're using an App Server's factory bean and maybe it doesn't implement or include the jar with that class in it? I'm not sure how JBoss's hibernate configuration matches or does not match the Spring way, but if you're on Spring, you want the Spring way primarily.

Here is setting up the entity factory - see the datasource injection, that's the key thing there. The transaction manager you use is Spring's delegate to the container's JTA manager, which relies on JBoss's configured datasources and is automatically enlisted (provide you've used XA drivers).



Here is an example of setting the persistence provider to Hibernate's entity manager - it's the org.hibernate.ejb.HibernatePersistence class:

persistence.xml:





 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More importantly, do you know that you're using <dependencyManagement> to define your dependencies?

That really means you're not defining real dependencies. You're stating a preference that if a sub-project or one of your dependencies depends on something, you want it to depend on that version. I don't see all of them being used down below, so I'm assuming some either aren't being imported or are transitive.

If you're unsure whether this build is correct, you need to do some digging... Maybe the problem is related to a mixed up jar import being missing.

You can do a mvn help:effective-pom and paste that, it will tell you how the pom evaluates and what jars end up in the project. Better yet, mvn dependency:list and mvn dependency:tree output -Dverbose=true - that will tell us what it selected, and what conflicts, if any, existed.


 
Brajesh Choudhary
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ken

Thanks for your quick reply.I have solved the previous problem but now a new problem comes.

Here is the stack trace





my spring-business-context.xml


my controller class


There is also a problem when I provide the hbm file or cfg file it gives error that file not found.As you see I have commented that code.
 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The app is running from the target, not from the source code. So it will never find files in src/main/resources, because those have all been copied to target/classes and are in your class path.

Try:

<value>hibernate.cfg.xml</value>

or

<value>classpath:hibernate.cfg.xml</value>

Ken
 
Ken Rimple
author
Posts: 63
Mac OS X Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, on line 52 of your spring config, the bean setter is setTblSysUserDetailDAO, so your setter name is invalid. The property should have a name of "tblSysUserDetailDAO" - that's why it can't understand this.

Best of luck continuing on your project. I'd definitely take time to match your properties to log errors - I do this all the time and whenever I hand code XML I pay the price ;)

IntelliJ, Netbeans or Springsource Tool Suite (eclipse with the Spring IDE plugins installed) should help you with CTRL-SPACE so that you are picking valid bean and field names.

Best,

Ken
 
reply
    Bookmark Topic Watch Topic
  • New Topic