users@glassfish.java.net

connectionFactory jndi lookup from standalone client

From: <glassfish_at_javadesktop.org>
Date: Mon, 20 Apr 2009 05:25:51 PDT

Hi everyone,

I've spent more than one day trying to insert a JMS message in a queue from a standalone client.

Here is what I've done :

- from glassfish console, create a connectionFactory with JNDI name "jms/connectionFactory"
- from glassfish console, create a queue with JNDI name="jms/queue1"
- from standalone java client, create file jndi.properties :

java.naming.factory.initial = com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url = mq://localhost:7676

- from standalone java client, trying to retrieve connectionFactory :

Context initialContext = new InitialContext();
ConnectionFactory connectionFactory = (ConnectionFactory) initialContext.lookup("jms/connectionFactory");

this fails with the following error :

Exception in thread "main" javax.naming.InvalidNameException: mq://localhost:7676 [Root exception is java.net.MalformedURLException: unknown protocol: mq]

I've spent my whole day googling for answers : some say that the provider URL should point to a directory on my file system (???), so other say that the JNDI lookup should be prefixed with "cn=" : I've tried everything, but nothing has worked so far.

Any help would be appreciated :-)

Thanks !
[Message sent by forum member 'sc_wizard29' (sc_wizard29)]

http://forums.java.net/jive/thread.jspa?messageID=342757