comp/env/pool not found in context "java:"?
05:46 20 May 2013

I have a web application trying to access a JNDI declared in WebSphere Application Server. The JNDI is declared under Object pool managers. However, I'm receiving an error when I access the pool. The error says that comp/env/pool is not found in context "java:".

My code is written as follows:

InitialContext initialContext = new InitialContext();
ObjectPoolManager opm = (ObjectPoolManager)initialContext.lookup("java:comp/env/pool");

Accessing the pool via the code below works:

ObjectPoolManager opm = (ObjectPoolManager)initialContext.lookup("pool");

I'm confused because according to what I've found on the internet, java:comp/env/ is a default prefix for JNDI. So why does it cause an error in my case?

Thank you!

java websphere jndi pool