...
See rule 2 and rule 4. There will be nothing in java:comp/env unless you Declare a Reference to it. It does not matter if is a DataSource configured a at the server level, etc. Nothing is bound into java:comp/env unless you explicitly declare a reference to it. The Java EE 5 TCK (Technology Compatibility Kit) tests for this extensively and is a rule we cannot break. Java EE 6 does finally offer some new namesaces (java:global, java:app, and java:module) which will offer some great new options for more global-style lookups.
...
- "Which InitialContextFactory do I use for java:comp/env?"
See rule 8. You are not allowed to use an InitialContextFactory for java:comp/env lookups. Setting an InitialContextFactory via 'java.naming.factory.initial' in either System properties, InitialContext properties, or a jndi.properties file is illegal and will cause java:comp/env lookups to fail.
...