3 Replies Latest reply on Nov 21, 2006 3:01 PM by weston.price

    Configuring EJB

    fullcircle

      Any idea how I pass configuration data to an EJB? Ive wasted hours trying to sort this out ... any help would be much appreciated! Thx

        • 1. Re: Configuring EJB
          peterj

          You could place a properties file in the same directory as the EJB class file and access it using this.class().getResourceAsStream(prop-file-name).

          You could place a properties file in server/default/data and access it as follows:

          String datadir = System.getProperties("jboss.server.data.dir");
          File f = new File(datadir + "/" + prop-file-name);

          • 2. Re: Configuring EJB
            fullcircle

            Thanks - searched for ages for that kind of a gem!

            • 3. Re: Configuring EJB
              weston.price

              Also, you have the ENC (JNDI) to play with as well. Environment entries can be set in your ejb-jar.xml descriptor (or injected with EJB3). I often find this 'cleaner' than using a properties file as the EJB contains all the necessary information needed to deploy and run. However, neither approach is better than the other.