|
Tobias Unger created QPID-3971:
---------------------------------- Summary: PropertiesFileInitialContextFactory cannot open file URL Key: QPID-3971 URL: https://issues.apache.org/jira/browse/QPID-3971 Project: Qpid Issue Type: Bug Components: Java Client Affects Versions: 0.14 Environment: MAC OS 10.7, java version "1.6.0_31" Reporter: Tobias Unger Hi all, I have to configure JNDI by a properties file. For example: String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); System.setProperty(Context.PROVIDER_URL, "path/to/file"); Context context = new InitialContext(); Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:120) at java.io.FileInputStream.<init>(FileInputStream.java:79) Looking at PropertiesFileInitialContextFactory [2] it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... Many thanks, Tobias [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tobias Unger updated QPID-3971: ------------------------------- Description: Hi all, I have to configure JNDI by a properties file. For example: String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); System.setProperty(Context.PROVIDER_URL, "path/to/file"); Context context = new InitialContext(); Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:120) at java.io.FileInputStream.<init>(FileInputStream.java:79) Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... Many thanks, Tobias [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup was: Hi all, I have to configure JNDI by a properties file. For example: String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); System.setProperty(Context.PROVIDER_URL, "path/to/file"); Context context = new InitialContext(); Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:120) at java.io.FileInputStream.<init>(FileInputStream.java:79) Looking at PropertiesFileInitialContextFactory [2] it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... Many thanks, Tobias [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13260444#comment-13260444 ] Weston M. Price commented on QPID-3971: --------------------------------------- In looking at this I would agree, this seems to be something we should support. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Weston M. Price reassigned QPID-3971: ------------------------------------- Assignee: Weston M. Price > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Weston M. Price resolved QPID-3971. ----------------------------------- Resolution: Fixed Fix Version/s: 0.17 Fixed on trunk with new unit tests showing functionality. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Weston M. Price reopened QPID-3971: ----------------------------------- This is not a functionality re-open but a test issue. I need to find a better way to test with an absolute: file://path-to-file The original checkin worked fine in my local environment, but the build machine has paths with invalid characters that broke the test suite. Will rework to come up with a better testing strategy. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274262#comment-13274262 ] Robbie Gemmell commented on QPID-3971: -------------------------------------- The commit in r1337829 (http://svn.apache.org/viewvc?rev=1337829&view=rev) to address the above update was tagged for QPID-3994 instead of this JIRA, and also failed on the CI machine due to a missing path seperator when creating the temp file. I have made a commit to hopefully resolve that failure whilst adding some other improvements. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274272#comment-13274272 ] Weston M. Price commented on QPID-3971: --------------------------------------- Thanks for the improvements Robbie. Sort of frustrating when the test suite runs fine locally. I don't know the CI environment well enough I suppose. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Weston M. Price closed QPID-3971. --------------------------------- Resolution: Fixed Fixed with patch and improvements from Robbie. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274278#comment-13274278 ] Robbie Gemmell commented on QPID-3971: -------------------------------------- I only noticed it fail originally because of the CI emails, but I was working on something else at the time and it failed for me locally as well when I tested that (java.io.FileNotFoundException: /tmphello.properties (Permission denied)) so I just made the changes to stop my other commit prompting a second set of failure emails. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by JIRA jira@apache.org
[ https://issues.apache.org/jira/browse/QPID-3971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274279#comment-13274279 ] Weston M. Price commented on QPID-3971: --------------------------------------- Probably a difference in the way different operating systems handle the tmp file. Admittedly I should have run the test on Linux VM. > PropertiesFileInitialContextFactory cannot open file URL > -------------------------------------------------------- > > Key: QPID-3971 > URL: https://issues.apache.org/jira/browse/QPID-3971 > Project: Qpid > Issue Type: Bug > Components: Java Client > Affects Versions: 0.14 > Environment: MAC OS 10.7, java version "1.6.0_31" > Reporter: Tobias Unger > Assignee: Weston M. Price > Fix For: 0.17 > > > Hi all, > I have to configure JNDI by a properties file. For example: > String INITIAL_CONTEXT_FACTORY = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory"; > System.setProperty(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY); > System.setProperty(Context.PROVIDER_URL, "path/to/file"); > Context context = new InitialContext(); > Everything works fine until the "Context.PROVIDER_URL" contains a "real" URL instead of a file path. In our example the "Context.PROVIDER_URL" is set by a third party library. But using an URL here causes an FileNotFoundException in [3]. > java.io.FileNotFoundException: file:/Users/.../qpid-jndi.conf (No such file or directory) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(FileInputStream.java:120) > at java.io.FileInputStream.<init>(FileInputStream.java:79) > Looking at PropertiesFileInitialContextFactory (cf. [2] line 85) it's clear what happens. It tries to open the URL using a FileInputStream. At least on my Mac that doesn't work. My question is whether Qpid should be modified to accept File-URLs since Context.PROVIDER_URL is specified as an URL in [1] and apparently some libraries take it seriously... > Many thanks, > Tobias > [1] http://docs.oracle.com/javase/6/docs/api/javax/naming/Context.html#PROVIDER_URL > [2] http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?view=markup -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
| Powered by Nabble | Edit this page |
