Package javax.naming

Examples of javax.naming.InitialContext.bind()


         String connQosTxt = null;
         boolean forQueues = false;
         this.factory = new XBConnectionFactory(connQosTxt, this.args, forQueues);
         this.topic = new XBDestination(TOPIC, null, false);
         ctx.bind(CONNECTION_FACTORY, this.factory);           
         ctx.bind(TOPIC, this.topic);
      }
      catch (NamingException ex) {
         ex.printStackTrace();
         assertTrue("exception occured in testJndi", false);
      }
View Full Code Here


            System.out.println("Using System.getProperty(java.naming.factory.initial)=" + System.getProperty("java.naming.factory.initial"));
         }
        
         InitialContext context = new InitialContext(properties);
         if (fillNames) {
            context.bind("first", new String("first"));
            context.bind("second", new String("first"));
            context.bind("third", new String("first"));
            context.createSubcontext("dir1");
            context.createSubcontext("dir2");
            context.createSubcontext("dir3");
View Full Code Here

                            currentContext = (Context) currentContext
                                    .lookup(fullName.get(0));
                        }
                        fullName = fullName.getSuffix(1);
                    }
                    ic.bind(name, this.objectsToCreate.get(name));
                    Logger.log(Logger.FULL_DEBUG, JNDI_RESOURCES,
                            "ContainerJNDIManager.BoundResource", name);
                } catch (NamingException err) {
                    Logger.log(Logger.ERROR, JNDI_RESOURCES,
                                    "ContainerJNDIManager.ErrorBindingResource",
View Full Code Here

         // Deploy something into the server 1 JNDI namespace

         InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment(1));

         ic.bind("/", "bingo");

         log.debug("deployed");

         // feed the service with an JNDI environment from server 1
View Full Code Here

   implements ExitOnShutdownMBean
{
   protected void startService() throws Exception
   {
      InitialContext ctx = new InitialContext();
      ctx.bind("ExitOnShutdown", Boolean.TRUE);
   }

   protected void stopService()
   {
      final Runtime r = Runtime.getRuntime();
View Full Code Here

    */
   public void start() throws Exception
   {     
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.bind(NAME, VALUE);
      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
      ctx.bind(BAD_BINDING, new NonDeserializable());
      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
     
      // For some reason creating a context for our own JNDI doesn't work
View Full Code Here

   {     
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.bind(NAME, VALUE);
      log.info("Bound " + VALUE + " to " + ctx + " under " + NAME);
      ctx.bind(BAD_BINDING, new NonDeserializable());
      log.info("Bound a NonDeserializable to " + ctx + " under " + BAD_BINDING);
     
      // For some reason creating a context for our own JNDI doesn't work
      // inside the server, so as a hack we directly deal with the NamingServer
      // to bind the object
View Full Code Here

      Object data = ctx.lookup("readonly/data");
      getLog().debug("lookup(readonly/data) : "+data);
      try
      {
         // Try to bind into the readonly context
         ctx.bind("readonly/mydata", "otherdata");
         fail("Was able to bind into the readonly context");
      }
      catch(UndeclaredThrowableException e)
      {
         getLog().debug("Invalid exception", e);
View Full Code Here

      catch(NamingException ignore)
      {
      }
      getLog().debug("Creating readonly context");
      bootCtx.createSubcontext("readonly");
      bootCtx.bind("readonly/data", "somedata");

      // Test access through the readonly proxy
      env.setProperty("bootstrap-binding", "naming/ReadOnlyNaming");
      getLog().debug("Creating InitialContext with env="+env);
      InitialContext ctx = new InitialContext(env);
View Full Code Here

      redeployNaming();
     
      Context ctx2 = new InitialContext(env);
      try
      {
         ctx2.bind(BIND_NAME, BIND_VALUE);
      }
      catch (NamingException e)
      {
         log.error("Caught NamingException", e);
         fail(e.getMessage());
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.