Hi Robert,

On Apr 7, 2008, at 1:12 AM, Robert Greig wrote:
On 07/04/2008, George Thiruvathukal <[EMAIL PROTECTED]> wrote:

$ cat qpid.bindings
QueueConnectionFactory=org.apache.qpid.client.AMQConnectionFactory
...

You need to prefix the key with the type of object, e.g.

connectionfactory
.QueueConnectionFactory=org.apache.qpid.client.AMQConnectionFactory


Really? That doesn't seem work. From the thrown exception it looks like the lookup key is just "QueueConnectionFactory":

   ...
JNDI lookup failed: javax.naming.NameNotFoundException: QueueConnectionFactory Connection problem: javax.naming.NameNotFoundException: QueueConnectionFactory

ReadOnlyContext is indeed looking for QueueConnectionFactory in the 'bindings' Map, not 'environment' (since things are transposed). Also, I hooked this up to jdb and found that doing the lookup on the short name in 'environment' within ReadOnlyContext.lookup() would work:

   $ jdb SenderToQueue SQ
   Initializing jdb ...
   > catch caught javax.naming.NameNotFoundException
   Deferring caught javax.naming.NameNotFoundException.
   It will be set after the class is loaded.
   > run
   run SenderToQueue SQ
   Set uncaught java.lang.Throwable
   Set deferred uncaught java.lang.Throwable
   >
   VM Started: Queue name is SQ
main 2008-04-07 02:19:28,144 INFO [apache.qpid.jndi.PropertiesFileInitialContextFactory] Loading Properties
   from:/home/georget/mqtest/qpid-jclient/samples/qpid.bindings
main 2008-04-07 02:19:28,146 INFO [apache.qpid.jndi.PropertiesFileInitialContextFactory] Loaded Context Properties:{QueueConnectionFactory/RefAddr/2/Type=defaultUsername, QueueConnectionFactory/RefAddr/1/Content=5672,
   ...
   Set deferred caught javax.naming.NameNotFoundException

Exception occurred: javax.naming.NameNotFoundException (to be caught at: SampleUtilities.jndiLookup(), line=172 bci=65)"thread=main",
   org.apache.qpid.jndi.ReadOnlyContext.lookup(), line=271 bci=170

   main[1] dump environment.get(QueueConnectionFactory)
com.sun.tools.example.debug.expr.ParseException: Name unknown: QueueConnectionFactory
   environment.get(QueueConnectionFactory) = null
   main[1] dump environment.get("QueueConnectionFactory")
environment.get("QueueConnectionFactory") = "org.apache.qpid.client.AMQConnectionFactory"


Cheers,

George

Reply via email to