A servlet container inverts control by managing the lifecycle of the servlet. Inversion of Control does not mean that you have access to the servlet management system. In fact, Inversion of Control means that you don't *need* access to the servlet management system. You don't *want* to depend on the servlet management system directly: that would create a cyclic dependency.
In your example of servlet container together with a JNDI directory, only the servlet container inverts control, and the JNDI directory is an implementation detail of how the servlet container could find components. Nothing about the JNDI directory inverts control. If the servlet container hides the JNDI directory from the rest of the system, then at least the programmer can't create a cyclic dependency.
Inversion of Control does not include component lookup. In fact, Inversion of Control has the goal of taking component lookup out of your hands, letting you simply declare the components you need as parameters. If you look up components yourself, you break the inversion.