[
https://issues.apache.org/jira/browse/QPID-5426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ulrich Romahn updated QPID-5426:
--------------------------------
Attachment: PropertiesFileInitialContextFactory.java
Revised file that will use a URL to load the properties file.
> PropertiesFileInitialContextFactory only working with properties file on
> absolute path
> --------------------------------------------------------------------------------------
>
> Key: QPID-5426
> URL: https://issues.apache.org/jira/browse/QPID-5426
> Project: Qpid
> Issue Type: Bug
> Components: Java Client
> Affects Versions: 0.26
> Environment: n/a
> Reporter: Ulrich Romahn
> Attachments: PropertiesFileInitialContextFactory.java
>
>
> 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);
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]