On 07/04/2008, George Thiruvathukal <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I just started playing around with Qpid and I've been trying to see if Qpid
> is compatible with Sun's suite of sample JMS code (without any modification
> to the Sun's sample code). But it appears that the binding class name for
> the QueueConnectionFactory are ending up in the wrong java.util.Map inside
> org.apache.qpid.jndi.ReadOnlyContext.
>
>  Instead of ending up in the Map called "bindings", it is ending up in the
> Map called "environment" and therefore does not resolve into an instantiated
> object when ReadOnlyContext.lookup() is called.
>
>  I'll be more than happy to provide a patch. But I'm new to JNDI/JMS and so
> I want to make sure this isn't a configuration error on my part.
>
>  Here's my setup:
>
>  - I'm trying to use JNDI via a file system configuration instead of with a
> directory server.
>
>  So I created a "jndi.properties" file that looks like this:
>
>   $ cat jndi.properties
>   java.naming.factory.initial =
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory
>   java.naming.provider.url =
> /home/georget/mqtest/qpid-jclient/samples/qpid.bindings
>
>  Now, I realize that java.naming.provider.url is supposed to be a URL, but
> when I used "file:///" syntax, the file failed to load. It actually loads
> this way!
>
>  Anyway, I next created the "qpid.bindings" file as follows:
>
>   $ cat qpid.bindings
>
> QueueConnectionFactory=org.apache.qpid.client.AMQConnectionFactory
>   ...
>
>  Anyway, the qpid.bindings file gets read with no problems via the
> getInitialContext() method in
> org.apache.qpid.jndi.PropertiesFileInitialContextFactory.
>
>  One things that looks suspicious in
> PropertiesFileInitialContextFactory.java is this code
> snippet:
>
>    protected ReadOnlyContext createContext(Map data, Hashtable environment)
>    {
>        return new ReadOnlyContext(environment, data);
>    }
>
>  Why are environment and data getting swapped?
>
>  Any thoughts? Does this look like a bug(s)? Or am I misconfiguring things?
> Should I be using Sun's InitialContext factory instead
> (com.sun.jndi.fscontext.RefFSContextFactory)?
>
>  Thanks in advance!
>
>  Cheers,
>
>  George

Hi George,

Good spot. I saw this recently during testing and completely forgot to
raise a JIRA for it. If you have a patch for it that is great. I agree
it does seem a bit odd having environment and data transposed like
that. Would be good to add in a unit test to ensure we don't have a
regression on the issue.

Regards

Martin

-- 
Martin Ritchie

Reply via email to