Package javax.naming

Examples of javax.naming.Context.lookup()


     * @throws Exception if exception is found.
     */
    public static void main(final String[] args) throws Exception {
        Context initialContext = getInitialContext();

        TimerBeanRemote timerBean = (TimerBeanRemote) initialContext.lookup("timerBean");

        System.out.println("Calling init method that will fire a new timer...");
        timerBean.init();
    }

View Full Code Here


        // Build Context
        Context initialContext = getInitialContext();

        // Get factory
        QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext
                .lookup(QUEUE_CONNECTION_FACTORY);

        // Lookup the Queue through its JNDI name
        Queue queue = (Queue) initialContext.lookup(SAMPLE_QUEUE);
        Queue queueContext = (QueueinitialContext.lookup(SAMPLE_QUEUE_CONTEXT);
View Full Code Here

        // Get factory
        QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext
                .lookup(QUEUE_CONNECTION_FACTORY);

        // Lookup the Queue through its JNDI name
        Queue queue = (Queue) initialContext.lookup(SAMPLE_QUEUE);
        Queue queueContext = (QueueinitialContext.lookup(SAMPLE_QUEUE_CONTEXT);


        // Create connection
        QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
View Full Code Here

        QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext
                .lookup(QUEUE_CONNECTION_FACTORY);

        // Lookup the Queue through its JNDI name
        Queue queue = (Queue) initialContext.lookup(SAMPLE_QUEUE);
        Queue queueContext = (QueueinitialContext.lookup(SAMPLE_QUEUE_CONTEXT);


        // Create connection
        QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
View Full Code Here

    public static void main(final String[] args) throws Exception {

        Context initialContext = getInitialContext();

        // Call EJB3 bean
        EJB3RemoteBusinessInterface ejb3Bean = (EJB3RemoteBusinessInterface) initialContext
                .lookup("org.ow2.easybeans.examples.migrationejb21.EJB2And3Bean"
                        + "_" + EJB3RemoteBusinessInterface.class.getName() + "@Remote");
        System.out.println("Calling hello() method on EJB 3.0 view of the Bean...");
        ejb3Bean.hello();
View Full Code Here

        System.out.println("Calling hello() method on EJB 3.0 view of the Bean...");
        ejb3Bean.hello();


        // Call EJB2.1 bean
        EJB2RemoteHome ejb2Home = (EJB2RemoteHome) initialContext
                .lookup("org.ow2.easybeans.examples.migrationejb21.EJB2And3Bean"
                        + "_" + EJB2RemoteHome.class.getName());
        // Create bean
        EJB2RemoteInterface ejb2Bean = ejb2Home.create();
        System.out.println("Calling hello() method on Remote EJB 2.1 view of the Bean...");
View Full Code Here

                this.logger.error("Cannot get an initial context", e);
                return false;
            }
            Object adm = null;
            try {
                adm = initialContext.lookup(admName);
            } catch (NamingException e) {
                this.logger.error("No {0} object found in the initial context", admName, e);
                return false;
            }
View Full Code Here

        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
        "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
        Context initialContext = new InitialContext();

        for (int i = 0; i < n; i++) {
            Object bean = initialContext.lookup(beanClass.getName() + "_" + beanInterface.getName() + ITF_REMOTE);
            this.invokeMethod(n, bean);
        }
    }

    /**
 
View Full Code Here

        // sets the context
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");

        Context initialContext = new InitialContext();
        EJBContext ejbContext = (EJBContext) initialContext.lookup("java:comp/EJBContext");
        return ejbContext;
    }
}
View Full Code Here

    public static synchronized <E> E getBeanRemoteInstance(final Class beanClass, final Class<E> beanInterface) throws Exception {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");

        Context initialContext = new InitialContext();
        E clBean = (E) initialContext.lookup(beanClass.getName() + "_" + beanInterface.getName() + ITF_REMOTE);
        return clBean;
    }

    /**
     * Gets a local instance of a bean.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.