I am running a stand alone jms program. Sample code is: Properties env = new Properties(); env.setProperty(Context.PROVIDER_URL, "iiop://localhost:900"); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
while running the same I get the exception: javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment. javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment. at com.ibm.ws.naming.java.javaURLContextFactory.isNameSpaceAccessable(javaURLContextFactory.java:98) at com.ibm.ws.naming.urlbase.UrlContextFactory.getObjectInstance(UrlContextFactory.java:73) at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:579) at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:528) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:275) at javax.naming.InitialContext.lookup(InitialContext.java:347) at com.txlifeadapter.jms.MessageSender.<init>(MessageSender.java:47) at com.txlifeadapter.jms.MessageClient.init(MessageClient.java:25) at com.txlifeadapter.jms.MessageClient.main(MessageClient.java:53) init2
Valentin Tanase
Ranch Hand
Joined: Feb 17, 2005
Posts: 704
posted
0
Hi Monoranjan,
Pass the properties to the initial context like this:
Let me know if it works. Regards.
I think, therefore I exist -- Rene Descartes
Monoranjan Gorai
Greenhorn
Joined: Jul 25, 2005
Posts: 19
posted
0
My code is like the following: env.setProperty(Context.PROVIDER_URL, "iiop://localhost:2809"); env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
System.out.println("Getting connection factory...."); // Finding the WAS QueueConnectionFactory javax.jms.ConnectionFactory qcf = (javax.jms.ConnectionFactory) initCtx.lookup(JMSCF_JNDI_NAME); System.out.println("qcf="+qcf); // Finding the Queue Destination Destination q = (Destination) initCtx.lookup(JMSQ_JNDI_NAME);
I am getting exception as:
Oct 26, 2005 4:10:11 PM com.ibm.ws.naming.java.javaURLContextFactory SEVERE: javaAccessorNotSet javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment. at com.ibm.ws.naming.java.javaURLContextFactory.isNameSpaceAccessable(javaURLContextFactory.java:98) at com.ibm.ws.naming.urlbase.UrlContextFactory.getObjectInstance(UrlContextFactory.java:73) at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:579) at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:528) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:275) at javax.naming.InitialContext.lookup(InitialContext.java:347) at sender.Main.main(Main.java:29)
Valentin Tanase
Ranch Hand
Joined: Feb 17, 2005
Posts: 704
posted
0
Hi Monoranjan,
Couple of hints:
Make sure that the JMS administrator created and bounded a JMS ConnectionFactory to jndi.
Make sure the name JMSCF_JNDI_NAME is correct (are you using java:comp/env/� for looking up the connection factory?).
Regards.
Monoranjan Gorai
Greenhorn
Joined: Jul 25, 2005
Posts: 19
posted
0
Hi, I have checked both then also getting the same error.