Details
-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
JBossAS-4.0.4RC1
-
None
-
Low
Description
The java:comp binding is implemented via a reference bound under the root of the java: scheme. This reference works by using org.jboss.naming.ENCFactory to obtain a JNDI Context for these lookups. ENCFactory maintains a a mapping of context class loader to Context to implement the context locality of these bindings. Unfortunately this means that all lookups under java:comp will use the shared NamingContext object - thus the environment of the parent contexts are ignored during lookup, and environment changes made to the java:comp context are shared.
One consequence of this is that a binding linked via java:comp man return a different result if looked directly (even using the same InitialContext) since the JNDI environment of the used context is effectively substitued for that of the shared java:comp context (ultimately derived from the environment of the parent context used by the lookup that caused the creation of the java:comp context).
JBAS-1490 indicates that a rewrite of this system is planned to enforce the read only constraint on the EJB enc, so it seems an oppotune time to fix this system.
The issues with sharing of the context instance could be addressed by caching the NamingServer instance (as opposed to a NamingContext wrapping a NamingServer) and creating an new wrapping context for each resolution of java:comp using the passed environment - this change of architecture would also allow substituion of read only context (or context wrappers) for certain lookup conditions.