• 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

Spring MVC - no ContextLoaderListener registered

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all
I use Spring MVC and want to use openSessionInViewFilter
My configuration as below
hibernate-conf.xml


crud-conf.xml


mvc-conf.xml


web.xml


If I didn't register ContextLoaderListener , it will occur no ContextLoaderListener registered exception.
But if I register contextLoaderListener , it should specify contextConfigLocation for hibernate sessionFactory.
But the hibernate sessionFactory had been load in the spring mvc(in web.xml line 09).
Because RoleCrud refer HibernateTemplate that defined in the hibernate-conf.xml.
So these three configuration(crud-conf.xml,mvc-conf.xml,hibernate-conf.xml) should be load together for Spring to know all beans.
How do I solve the problem that the hibernate-conf.xml load in these two place , and this will let Spring openSessionInViewFilter get another problem and inactive.

Thanks in advance!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not just define those config files in the context loader listener?
 
avseq anthoy
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:Why not just define those config files in the context loader listener?


Thanks for your reply!
Now I just put the mvc-config in DispatcherServlet , and the other config files in the context loader.
And the problem had benn solved.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great; glad to hear you figured it out :)
 
reply
    Bookmark Topic Watch Topic
  • New Topic