The most recent project I'm working on involves IBM Websphere 6.1. I've fought the technology and lost several times, but I was determined to get some pretty basic JNDI stuff working properly.
I have a resource set up on Websphere, lets make it a JMS ConnectionFactory and call it Bob. It's JNDI location is jms/bob and its all set up correctly.
My web application, being totally clueless about Bob or it's JNDI location, declares a resource in web.xml in the usual way, and specifies it's internal name as jms/fred. This is all standard JavaEE. Deploying the app into Websphere, it gives me the opportunity to map my resource at jms/bob to my declared resource jms/fred. Looks good! Except, when performing the deployment I get errors in the logs:
Looking up JNDI object with name [java:/comp/env/jms/fred]
javax.naming.NameNotFoundException: Name not found in context "java:".
What the heck, name "blank" not found in the java context? I'm sure I just asked for /comp/env/jms/fred, and it says so in the log! Thanks WAS for another unhelpful error message. Google didn't help me either, but I did end up finding the problem. Here is is for posterity.
See that first slash, the one before "comp". IBM Websphere does not like it, and will give that cryptic error if you include it. Some application servers seem to be forgiving, but not WAS.
Get rid of the leading slash, and all will be well. It's not java:/comp/env, it's java:comp/env!