Discussions

EJB design: initial context from a novice

  1. initial context from a novice (1 messages)

    Hi all
    i'm a brand new ejb programmer.
    I have this question with initial context.
    WHen you want to use an EJB, you have to look it up through JNDI. When you call
    Context ctx=initialContext();
    i have seen 3 ways:
    1.use FactoryProvider and URL parameters

    2. use system properties

    3. blank.

    COuld some one tell me what's the difference between these 3 ways? WHen to use which? Are they Application Server specific?
    Thanks a lot
    WJG
     
  2. initial context from a novice[ Go to top ]

    The difference is more convenience then conceptual...
    In all the three cases all JNDI cares is for the provider URL and the context factory...

    1. you explicity give the data in the code

    2. JNDI will get this data from the system properties..

    3. JNDI will get the data from a file called jndi.properties and it will search for this file in your class path.

    Read the api documentation for Context for more information.

    Kiran.