1 Reply Latest reply on Mar 1, 2003 11:57 AM by andygodwin

    Where to store Application wide configuration?

    rdefalco

      Hello,
      I have a J2EE app (.ear) that is composed by several ejb jars containing their own ejb-jar.xml, and a web app packaged in a .war in the same ear.
      I want to get application wide configuration parameters (mostly strings), like for exemple the locale that is to be used accros an instance of this application. I would like to store these parameters in a portable manner across different application server and i do not want to scatter this parameters in all the ejb-jar.xmls and web.xmls. I would like something like system properties (but what if application is clustered ?) or jndi name/value mechanisms (how to access it from all the components of the application since each has distinct namespace?).
      Any ideas or previous experiences appreciated.

      Richard

        • 1. Re: Where to store Application wide configuration?
          andygodwin

          Don't know if this helps, but in a recent project
          I used a Dynamic MBean to do this, called it simply
          the Config Service. Read the configuration data
          from a file at startup then bound itself into JNDI.

          The configuration properties simply appeared as
          attributes of the Dynamic MBean.

          EJBs, etc, access the Config Service either using
          MBeanServer methods, getAttribute(..) etc, or by
          looking up the service from JNDI and calling on
          the returned proxy. The JNDI approach would work
          in a clustered setup with HA-JNDI, for a guess.

          Also the service appears in the JMX console, so
          you can monitor or update properties from the
          console.

          Because my app integrated with non Java systems,
          the Config Service also opened a server socket
          to accept requests using a simple XML protocol.

          I don't know about different app servers, but they
          are all starting to adopt JMX and MBeans aren't
          they? If not, it's about time they did :)

          HTH

          Andy