Just finished writing a custom login module that I can deploy to my tomcat installation. I declared the datasource that the login module uses as a global resource in the server.xml and was trying to look it up in my login module when doing the Authentication / Authorisation stuff. The problem I had was that I couldn't find the datasource in the JNDI tree, I quickly realised this was because the login module was looking in the context for the web application and therefore I needed to create a link which I did it using a . So what I don't understand is why I needed to do this. Given that the login-module is actually part of the container rather than a specific web application why can it not see globally available resources. I just need a bit of clarification on this if anyone is willing to offer it up.