Package javax.naming

Examples of javax.naming.Context.lookup()


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

        // Lookup the Queues through their JNDI name
        Queue annotationQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_ANNOTATION);
        Queue xmlQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_XML);

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


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

        // Lookup the Queues through their JNDI name
        Queue annotationQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_ANNOTATION);
        Queue xmlQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_XML);

        // Create connection
        queueConnection = queueConnectionFactory.createQueueConnection();

        // Create session
View Full Code Here

        }

        // Lookup server object
        Object serverObject = null;
        try {
            serverObject = ictx.lookup(RMIServerRPC.RPC_JNDI_NAME);
        } catch (NamingException ne) {
            throw new IllegalStateException(ne);
        }
        // Get a connection to the RPC server
        RMIServerRPC server = (RMIServerRPC) PortableRemoteObject.narrow(serverObject, RMIServerRPC.class);
View Full Code Here

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

        Context initialContext = getInitialContext();

        ISingletonShared singleton1 = (ISingletonShared) initialContext
                .lookup("SingletonBean1");

        ISingletonShared singleton2 = (ISingletonShared) initialContext
        .lookup("SingletonBean2");

View Full Code Here

        Context initialContext = getInitialContext();

        ISingletonShared singleton1 = (ISingletonShared) initialContext
                .lookup("SingletonBean1");

        ISingletonShared singleton2 = (ISingletonShared) initialContext
        .lookup("SingletonBean2");


        System.out.println("before: " + singleton1.getShared());
View Full Code Here

     */
    public static void main(final String[] args) throws Exception {
        Context ictx = getInitialContext();

        // JNDI name was specified as mappedName attribute in the stateless bean
        StatelessRemote statelessBean = (StatelessRemote) ictx.lookup("securityBean");

        // Not authenticated but method can be called
        System.out.println("Calling methods that everybody can call...");
        statelessBean.allRolesAllowed();

View Full Code Here

        if (n.size() > 1) {
            // sub context in the env tree
            String suffix = n.getSuffix(1).toString();
            // should throw exception if sub context not found!
            Context subctx = lookupCtx(n.get(0));
            return subctx.lookup(suffix);
        }
        // leaf in the env tree
        Object ret = this.bindings.get(name);
        if (ret == null) {
            logger.debug(" {0} not found.", name);
View Full Code Here

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

        // Lookup the Remote Bean interface through JNDI
        Context initialContext = getInitialContext();
        BusinessInterface facadeBean = (BusinessInterface) initialContext.lookup("JPA2Bean");

        // Init (if not done)
        System.out.println("Initializing the database with some employees...");
        facadeBean.init();

View Full Code Here

        this.logger.debug("globalContext = ''{0}''.", javaContext);
        String name = "name1";
        String value = "value1";
        global.bind(name, value);

        Assert.assertEquals(value, global.lookup(name));
    }

    /**
     * Test there is only java:global for all modules.
     * @throws NamingException if lookup fails
View Full Code Here

     */
    public void getBeanByLookup() throws NamingException, CreateException, RemoteException {
        // Obtain the default initial JNDI context.
        Context initCtx = new InitialContext();

        Object result = initCtx.lookup(getBeanName());

        SimpleEjb2Home beanHomeLookup = (SimpleEjb2Home) javax.rmi.PortableRemoteObject.narrow(result,
                SimpleEjb2Home.class);

        SimpleEjb2 beanLookup = beanHomeLookup.create(DEFAULT_CODE, DEFAULT_NAME);
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.