DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    1

    Thumbs up Stand alone JMS program

    I am getting exception while running a stand alone program:
    Properties env = new Properties();
    env.setProperty(Context.PROVIDER_URL, "iiop://localhost:900");
    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);




    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.j ava: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

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    255
    You need to pass those environment to the InitialContext constructor. The exception message clearly states so.

    Code:
    Context initCtx = new InitialContext(env);
    Last edited by aniseed; 10-29-2005 at 09:46 AM. Reason: Corrected the messed up code tags
    Happiness is good health and a bad memory.

Similar Threads

  1. JMS: simple program (urgent please)
    By mhkateb in forum Java
    Replies: 1
    Last Post: 03-07-2005, 02:34 PM
  2. problem in program in c++
    By mheasen in forum Architecture and Design
    Replies: 0
    Last Post: 03-20-2002, 09:24 AM
  3. Please help with running executable vb program.
    By Gordon Reichhardt in forum VB Classic
    Replies: 2
    Last Post: 01-08-2002, 10:06 AM
  4. How can I build copy protection into my program
    By W.Pierce in forum VB Classic
    Replies: 1
    Last Post: 12-11-2001, 08:28 AM
  5. Replies: 0
    Last Post: 12-15-2000, 10:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links