Ivan created GERONIMO-6475:
------------------------------

             Summary: Legacy JNDI context usage support
                 Key: GERONIMO-6475
                 URL: https://issues.apache.org/jira/browse/GERONIMO-6475
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: naming
    Affects Versions: 3.0.1
            Reporter: Ivan
            Assignee: Ivan
             Fix For: 3.0.2


One tradition usage for JNDI API is that, the users could configure a factory 
class while creating the Context instance, and the jar file contains the 
context factory is shipped in the user application. 

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.myContextFactory");
InitialContext ctx = new InitialContext(env);

While moving to OSGi, the typical scenario above will not work, as the current 
JNDI lookup follows the JNDI OSGi spec, except that the configured factory 
could be loaded from JRE, we will always return the default XBean context.

I could saw two solutions for this, 

a. Enable the leagacy JNDI support from Aries

http://svn.apache.org/repos/asf/aries/tags/jndi-0.3/jndi-legacy-support/src/main/java/org/apache/aries/jndi/legacy/support/LegacyInitialContextFinder.java

b. Add the similar logic in our DefaultInitialContextFactoryBuilder.

I would prefer the option b, considering the logic is so simple, and there is 
no need to import another  jar file, also, we may not suffer the potential 
ordering issue, since the current DefaultInitialContextFactoryBuilder will 
always return one context instance.

Another reason is that, in my opinion, once the users have specified the 
context factory and we failed to create the jndi context, there is no need to 
for the next step trying, also, the log should be print to notify the users for 
the errors.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to