Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.26
-
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);