Package javax.naming

Examples of javax.naming.InitialContext.bind()


            try
            {
               String bindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
               env.put(Context.PROVIDER_URL, bindAddress + ":" + getHaJndiPort());
               InitialContext haCtx = new InitialContext(env);
               haCtx.bind("HA_TEST", null);
               haCtx.unbind("HA_TEST");
               haContext = haCtx;
            }
            catch (Exception e)
            {
View Full Code Here


      while (en.hasMoreElements())
      {
         en.nextElement();
      }
      InitialContext ctx = new InitialContext();
      ctx.bind(name, "foo");
      assertEquals("foo", ctx.lookup(name));
      try
      {
         ctx.bind(name, "foo2");
         fail("A NameAlreadyBoundException is expected here");
View Full Code Here

      InitialContext ctx = new InitialContext();
      ctx.bind(name, "foo");
      assertEquals("foo", ctx.lookup(name));
      try
      {
         ctx.bind(name, "foo2");
         fail("A NameAlreadyBoundException is expected here");
      }
      catch (NameAlreadyBoundException e)
      {
         // expected exception
View Full Code Here

   public void testGetContext() throws Exception
   {   
      assertNotNull(System.getProperty(Context.INITIAL_CONTEXT_FACTORY));
      InitialContext ctx = new InitialContext();
      assertNotNull(ctx);
      ctx.bind("test", "test");
      assertEquals("test", ctx.lookup("test"));
      try
      {
         ctx.bind("test", "test2");
         fail("A NameAlreadyBoundException is expected here");
View Full Code Here

      assertNotNull(ctx);
      ctx.bind("test", "test");
      assertEquals("test", ctx.lookup("test"));
      try
      {
         ctx.bind("test", "test2");
         fail("A NameAlreadyBoundException is expected here");
      }
      catch (NameAlreadyBoundException e)
      {
         // expected exception
View Full Code Here

      if(ctx == null)
         throw new RuntimeException("JNDI Ctx name is null");
      try
      {
         InitialContext ic = new InitialContext();
         ic.bind(ctx, this.beanObject);
         log.debug("Bound in JNDI:" + this.beanObject.getClass().getCanonicalName()
               + " in JNDI at " +ctx);
      }
      catch (NamingException e)
      {
View Full Code Here

      ctx.rebind(DEFAULT_CACHE_POLICY_PATH, ref);
      log.debug("cachePolicyCtxPath="+cacheJndiName);

      // Bind the default SecurityProxyFactory instance under java:/SecurityProxyFactory
      SecurityProxyFactory proxyFactory = (SecurityProxyFactory) securityProxyFactoryClass.newInstance();
      ctx.bind("java:/SecurityProxyFactory", proxyFactory);
      log.debug("SecurityProxyFactory="+proxyFactory);
     
      //Handler custom callbackhandler
      if(callbackHandlerClass != JBossCallbackHandler.class)
      {
View Full Code Here

        p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");

        InitialContext initialContext = new InitialContext(p);

        // Here's the fun part
        initialContext.bind("inject", this);
    }

    public void test() throws Exception {

        userTransaction.begin();
View Full Code Here

    public void test() throws Exception {

        Properties properties = new Properties();
        properties.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
        InitialContext context = new InitialContext(properties);
        context.bind("inject", this);

        assertRefs();
    }

    protected void assertRefs() throws JMSException {
View Full Code Here

        p.put("openejb.altdd.prefix", "test");

        InitialContext initialContext = new InitialContext(p);

        // Here's the fun part
        initialContext.bind("inject", this);
    }

    public void test() throws Exception {

        userTransaction.begin();
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.