ejb configuration params through xml file or JNDI?

Discussions

EJB design: ejb configuration params through xml file or JNDI?

  1. Hi, I am not very familiar with ejbs but in developing regular web applications I would always have a config.xml that a singleton class would read and would initialize necessary classes with configuration parameters. Now comes EJB's. I would like to replicate this kind of behaviour. Right away I have three different .ear applications and they all have config.xml files. In essence each application has its own singleton. I know singletons are forbidden in ejb's since singleton is only per jvm and there is no guarantee that there is a single jvm. My configuration files are read only so I think I am safe doing, nevertheless I would like to find a correct solution. One of the recommendations I found is to use JNDI. So in essence have a singleton class, which all applications access through jndi. Is this the correct way of doing it? Is the following algorithm ok? 1. Start up all three applications. 2. One of the applications that is the main application reads the config.xml and creates the singleton class and stores it in JNDI 3. Other application just retrieve the object through jndi. Is it ok for an ejb to do IO in this case to read a config.xml file? Is there an another way of setting up configuration params? Thanks a lot.
  2. You go ahead with your idea, cheers, arijit
  3. Why would you want all your applications to use the same config file? Why can't they have their own config file?
  4. Thanks for your reply. They don't have to use the same config file they can have their own... I just used it as an example.
  5. Hi java, This is kelly NIIT student, please, what could be the problem when configuring Connection pool in admin consol of J2EE 1.4. The reason is that, i had check my hardware and software yet no solution . Please, can you send the required compatiable platform for J2EE 1.4(J2SE 8.1) to this email snookcent at yahoo dot com Thanks for your concern java student NIIT and member of SDN