JNDI vs properties file

Discussions

EJB design: JNDI vs properties file

  1. JNDI vs properties file (6 messages)

    Can I replace the properties file by register all the key-value pairs info in the Naming and directories server and connect using the JNDI? Any performance issues?

    Threaded Messages (6)

  2. JNDI vs properties file[ Go to top ]

    u sure can. But why ?

    it's faster to read the properties from a properties file than reading it from JNDI. Nevertheless, using JNDI means that it's distributed.

    HTH.

    alex
  3. JNDI vs properties file[ Go to top ]

    You absolutely should use JNDI instead of reading properties files. Especially since reading properties files is completely illegal in EJB (section 18.1.2)

    Dave Wolf
    Internet Applications Division
    Sybase
  4. JNDI vs properties file[ Go to top ]

    I understand the reason that we should use JNDI to lookup the properties and not read a properties file but
    how would I register my application level properties with JNDI?

    Thanks,
    Kiran
  5. JNDI vs properties file[ Go to top ]

    As per the J2EE spec you can register these as an EAR property.

    Dave Wolf
    Internet Applications Division
    Sybase
  6. JNDI vs properties file[ Go to top ]

    In the application deployment descriptor?
    The dtd of this descriptor does not define any elements for this purpose...

    Probably I am missing something here...
    Could you give me more details?

    Thanks,

    Kiran.
  7. JNDI vs properties file[ Go to top ]

    Sorry, section 18.1.2 of EJB 2.0 spec is not about this. It is about exception handling. Furthermore I cannot find any passage in all the document which prohibits use of properties file. Have never heard about this. Actually I am using property files heavily (even wrote a property handler using the singleton design pattern).

    Why? Because this is the only 'universal' way to store properties. JNDI is very good, I like it, BUT not every application server has support for it whereas property files are usable by every Java applicaton. Writing a highly generic framework for server-side components (business-tier) I must rely on the most common denominator because I don't know in which container the business objects will run as this is chosen by the application developer and not by the framework. So it is not guarantueed that JNDI is available (actually in the EJB infrastructure adapter I use JNDI because every EJB server has to use JNDI, for other environments (e.g. servlets) this is not the case).

    Regards,
    Thomas