This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filters initialized before context is ready

 
Craig Fox
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application contains filters which each have a static SessionFactory variable set. This is instantiated in the init() method, like so:



The filters are declared in web.xml, and there are multiple hibernate.cfg.xml files, due to the app needing to connect to multiple databases. The hibernate configuration files all declare a session factory object with a name attribute intended to match the factoryJndiName mentioned above.

Here is an example of one of my filters.



When I try to deploy the app on Tomcat 6.032, it runs the init() method for each filter before the context has had a chance to store the JNDI names for each SessionFactory. This causes the following error when executing ctx.lookup.



How do I ensure that the context has the jndi names for the SessionFactories set up before Tomcat initializes the filters?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic