Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI - finding absolute location of local context  RSS feed

 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a context that is defined in Tomcat as java:comp/env/jdbc/DbPool
We also use Sun's fscontext to allow the code to run invisibly in JUnit. In test I have the DataSource defined and read from jdbc/DbPool, but it would be better if I could keep the local context reference in code and configure fscontext to provide access to the DataSource from the same location.

Any thoughts on the best way to get the tests running without impacting the production code?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it turns out fscontext appears to resolve the context directly, so it created the binding at <context root directory>/java:comp/env/jdbc/DBPool where 'java:env' is just another directory. I haven't run the tests yet, but the DataSource has been bound.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!