Package javax.naming

Examples of javax.naming.InitialContext


/**
* Producer/Consumer generating dead messages.
*/
public class DMQClient {
  public static void main(String[] args) throws Exception {
    Context ictx = new InitialContext();
    Queue queue1 = (Queue) ictx.lookup("queue1");
    Queue queue2 = (Queue) ictx.lookup("queue2");
//    Queue queue3 = (Queue) ictx.lookup("queue3");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session prodSession = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Session consSession = cnx.createSession(true, 0);
   
View Full Code Here


import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.Session;

public class AConsumer {
  public static void main(String[] args) throws Exception {
    Context context = new InitialContext();
    ConnectionFactory cf = (ConnectionFactory) context.lookup("cf");
    javax.jms.Queue queue =(Queue)context.lookup("queue");
    context.close();
   
    Connection cnx = cf.createConnection();
    Session session = (Session) cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
//    session.setImplicitAck(true);
    session.setQueueMessageReadMax(100);
View Full Code Here

    MessageProducer  producer = null;
    TextMessage message = null;
    Queue queue = null;
    ConnectionFactory cf = null;

    Context initialContext = new InitialContext();
    cf = (ConnectionFactory) initialContext.lookup("cf");
    queue = (Queue) initialContext.lookup("queue");
    initialContext.close();

    cnx = cf.createConnection();
   
    session = cnx.createSession(true, Session.AUTO_ACKNOWLEDGE);
    cnx.start();
View Full Code Here

  public static void main(String[] args) throws Exception {
 
    System.out.println();
    System.out.println("Produces messages on the queue...");

    ictx = new InitialContext();
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("soapCf");
    Queue queue = (Queue) ictx.lookup("queue");
    ictx.close();

    Connection cnx = cf.createConnection();
View Full Code Here

        this.XADataSourceName = XADataSourceName;
    }

    private XADataSource getXADataSource() throws ResourceException {
        try {
            if (ic == null) ic = new InitialContext();
            XADataSource ds = (XADataSource) ic.lookup(XADataSourceName);
            return ds;
        } catch (Exception ex) {
            ResourceException rex = new ResourceException("");
            rex.setLinkedException(ex);
View Full Code Here

    if (args.length < 2) {
      user = args[2];
      pass = args[3];
    }

    ictx = new InitialContext();
    Queue queue = (Queue) ictx.lookup("ftpQueue");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
View Full Code Here

      Properties env = new Properties();
      env.put("java.naming.factory.initial", "fr.dyade.aaa.jndi2.client.NamingContextFactory");
      env.put("java.naming.factory.host", "localhost");
      env.put("java.naming.factory.port", "16400");
      ictx = new InitialContext(env);
     
      Queue queue = (Queue) ictx.lookup("queue");
      QueueConnectionFactory qcf = (QueueConnectionFactory) ictx.lookup("qcf");
      ictx.close();
View Full Code Here

  public static void main(String[] args) throws Exception {
    System.out.println();
    System.out.println("Consumes messages on the queue...");

    ictx = new InitialContext();
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("soapCf");
    Queue queue = (Queue) ictx.lookup("queue");
    ictx.close();

    Connection cnx = cf.createConnection();
View Full Code Here

    try {
      Destination dest;
     
      try {
        Context ctx = new InitialContext();
        dest = (Destination) ctx.lookup(destName);
      } catch (javax.naming.NamingException exc) {
        String shortName = removePrefix(destName);
        if ("javax.jms.Queue".equals(destType))
          dest = AdminModule.createQueue(serverId,
                                         shortName,
View Full Code Here

                            String className,
                            Properties prop) throws AdminException, ConnectException {
    Queue queue = null;

    try {
      Context ctx = new InitialContext();
      queue = (Queue) ctx.lookup(name);
    } catch (javax.naming.NamingException exc) {
      String shortName = removePrefix(name);
      queue = (Queue) AdminModule.createQueue(serverId, shortName, className, prop);
      queue.setFreeReading();
      queue.setFreeWriting();
View Full Code Here

TOP

Related Classes of javax.naming.InitialContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.