Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Stand alone JMS client not able to fine Connection Factory

  Asked By: Francisca    Date: Feb 13    Category: Java    Views: 2277
  

I have an issue:

Sample code:


Properties env = new Properties();
env.setProperty(Context.PROVIDER_URL,
"iiop://localhost:2809");
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");

InitialContext initCtx = new InitialContext();

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);

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(javaURLContex\
tFactory.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

Can anybody help me please?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Ginger Snyder     Answered On: Feb 13

Sounds like you missed to apply property to the InitialContext

i.e. Context initCtx = new InitialContext(env);

or this is a slieght typing error here, double check if the factory
full descriptive name is mapped to the JNDI name URL in deplyment
desciptor.

 
Didn't find what you were looking for? Find more on Stand alone JMS client not able to fine Connection Factory Or get search suggestion and latest updates.




Tagged: