4 Replies Latest reply: May 14, 2012 3:32 PM by Tom B RSS

    What jar files are required to lookup weblogic connection factory

    Krr1sh
      What jar files are required to use jars:

      import javax.naming.*;
      import javax.jms.*;


      I am basically trying to lookup the connection factory created in weblogic 10g. Found the following code but could not execute, seems missing some runtime jars.

      Please suggest.


      Sample code snippet trying:

      ////////////////////////
      public static void sendMessage(String url, String user, String password,
      String cf, String queue, String messageText) { 
      // create InitialContext
      Context ctx = null;
      Hashtable ht = new Hashtable();
      ht.put(Context.INITIAL_CONTEXT_FACTORY,
      "weblogic.jndi.WLInitialContextFactory");
      ht.put(Context.PROVIDER_URL, "t3://localhost:7101");
      ht.put(Context.SECURITY_PRINCIPAL, user);
      ht.put(Context.SECURITY_CREDENTIALS, password);

      System.out.println("Getting context");
      try {
      ctx = new InitialContext(ht);
      System.out.println("Context: "+ctx);
      // Use the context in your program
      }
      catch (NamingException e) {
      // a failure occurred
      e.printStackTrace();
      }
      finally {
      try {ctx.close();}
      catch (Exception e) {
      // a failure occurred
      }
      }
      /////////////////////////////


      Thanks
      Sai