Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-5426

PropertiesFileInitialContextFactory only working with properties file on absolute path

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.26
    • 0.29
    • None
    • n/a

    Description

      Currently the class org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory expects a properties file to be loaded for the initial JNDI context. However, the current implementation can only load a properties file that is on an absolute path on a file system. This prohibits bundling the properties file inside a package such as a jar or a WAR since the class cannot read the properties file from there.

      The attached patch is fixing that by providing the location of the properties file as a URL string. Usage can be as easy as:
      properties = new Properties();
      URL propertiesURL = this.getClass().getResource(PROPS_FILE);
      properties.put(Context.PROVIDER_URL, propertiesURL.toString());
      LOG.info("creating initial context");
      Context ctx = new InitialContext(properties);

      Attachments

        Activity

          People

            rgodfrey Robert Godfrey
            uromahn Ulrich Romahn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: