Package javax.naming

Examples of javax.naming.InitialContext.bind()


        if ("bind".equals(msg)) {
            try {
                final Context context = new InitialContext();
                context.bind("java:jboss/web-test", "Test");
                context.bind("java:comp/web-test", "Test");
                context.bind("java:/web-test", "Test");
            } catch (NamingException e) {
                throw new ServletException(e);
            }
        } else if ("check".equals(msg)) {
View Full Code Here


        if ("bind".equals(msg)) {
            try {
                final Context context = new InitialContext();
                context.bind("java:jboss/web-test", "Test");
                context.bind("java:comp/web-test", "Test");
                context.bind("java:/web-test", "Test");
            } catch (NamingException e) {
                throw new ServletException(e);
            }
        } else if ("check".equals(msg)) {
            try {
View Full Code Here

      // Set up the authenticators in JNDI such that they can be configured for web apps
      InitialContext ic = new InitialContext();
      try
      {
         ic.bind("TomcatAuthenticators", tomcatDeployer.getAuthenticators());
      }
      catch (NamingException ne)
      {
         if (log.isTraceEnabled())
            log.trace("Binding Authenticators to JNDI failed", ne);
View Full Code Here

                    server = (AxisServer)context.lookup(name);
                } catch (NamingException e) {
                    // Didn't find it.
                    server = super.getServer(environment);
                    try {
                        context.bind(name, server);
                    } catch (NamingException e1) {
                        // !!! Couldn't do it, what should we do here?
                    }
                }
            }
View Full Code Here

            try {
                service = (Service)context.lookup(name);
            } catch (NamingException e) {
                service = new Service(configProvider);
                try {
                    context.bind(name, service);
                } catch (NamingException e1) {
                    // !!! Couldn't do it, what should we do here?
                }
            }
        } else {
View Full Code Here

        JNDISetup.doSetup();

        MockDataSource dataSource = new MockDataSource();
        InitialContext context = new InitialContext();
        context.bind(descriptor.getParameters(), dataSource);

        try {

            JNDIDataSourceFactory factory = new JNDIDataSourceFactory();
            assertSame(dataSource, factory.getDataSource(descriptor));
View Full Code Here

        JNDISetup.doSetup();

        MockDataSource dataSource = new MockDataSource();
        InitialContext context = new InitialContext();
        context.bind("java:comp/env/" + descriptor.getParameters(), dataSource);

        try {

            JNDIDataSourceFactory factory = new JNDIDataSourceFactory();
            assertSame(dataSource, factory.getDataSource(descriptor));
View Full Code Here

                    context.createSubcontext(contextName);
                }
            }

            // bind
            context.bind(jndiName, value);
            log.info("JavaMail session bound to " + jndiName);
        }
    }

    public void doStop() throws Exception {
View Full Code Here

    throws Exception
    {
       
        InitialContext ic = new InitialContext();
        NameParser parser = ic.getNameParser("");
        ic.bind("foo", "xxx");
       
        Object o = ic.lookup("foo");
        assertNotNull(o);
        assertEquals("xxx", (String)o);
       
View Full Code Here

            //set the current thread's classloader
            currentThread.setContextClassLoader(childLoader1);

            InitialContext initCtxA = new InitialContext();
            initCtxA.bind ("blah", "123");
            assertEquals ("123", initCtxA.lookup("blah"));



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.