Package javax.naming

Examples of javax.naming.Context.unbind()


      // lookup binding - should return new value
      value = (String)lookup(naming, JNDI_KEY, true);
      assertEquals("lookup after HA-JNDI rebind operation", JNDI_VALUE2, value);
     
      // unbind it
      naming.unbind(JNDI_KEY)
     
      // lookup binding - should fail with NamingException
      value = (String)lookup(naming, JNDI_KEY, false);
      assertNull("lookup after HA-JNDI unbind operation", value);
     
View Full Code Here


    */
   public void stop() throws Exception
   {
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.unbind(NAME);
      log.info("Unbound " + NAME + " from " + ctx);
      ctx.unbind(BAD_BINDING);
      log.info("Unbound " + BAD_BINDING + " from " + ctx);
     
      // For some reason creating a context for our own JNDI doesn't work
View Full Code Here

   {
      // Standard JNDI
      Context ctx = new InitialContext();
      ctx.unbind(NAME);
      log.info("Unbound " + NAME + " from " + ctx);
      ctx.unbind(BAD_BINDING);
      log.info("Unbound " + BAD_BINDING + " from " + ctx);
     
      // 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

      redeployNaming();
     
      Context ctx2 = new InitialContext(env);
      try
      {
         ctx2.unbind(ObjectBinder.NAME);
      }
      catch (NamingException e)
      {
         log.error("Caught NamingException", e);
         fail(e.getMessage());
View Full Code Here

     */
    public void destinationRemoved(JmsDestination destination) {
        if (destination.getPersistent()) {
            try {
                Context context = _names.getInitialContext();
                context.unbind(destination.getName());
            } catch (NamingException error) {
                _log.error("Failed to remove destination "
                           + destination.getName() + " from JNDI", error);
            }
        }
View Full Code Here

    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();

    // Unbind the name in its proper context
    ctx.unbind(rname);
  }

  /**
   * Binds a new name to the object bound to an old name, and unbinds
   * the old name. This operation is not supported (read only env.)
View Full Code Here

    private void stop() {
        String jndiName = getJndiName();
        if (jndiName != null && jndiName.length() > 0) {
            try {
                Context context = new InitialContext();
                context.unbind(jndiName);
                log.info("JavaMail session unbound from " + jndiName);
            } catch (NamingException e) {
                // we tried... this is a common error which occurs during shutdown due to ordering
            }
        }
View Full Code Here

            }

            JndiBuilder.Bindings bindings = deployment.get(JndiBuilder.Bindings.class);
            if (bindings != null) for (String name : bindings.getBindings()) {
                try {
                    globalContext.unbind(name);
                } catch (Throwable t) {
                    undeployException.getCauses().add(new Exception("bean: " + deploymentID + ": " + t.getMessage(), t));
                }
            }
        }
View Full Code Here

        }

        for (PersistenceUnitInfo unitInfo : appInfo.persistenceUnits) {
            try {
                Object object = globalContext.lookup(PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);
                globalContext.unbind(PERSISTENCE_UNIT_NAMING_CONTEXT + unitInfo.id);

                // close EMF so all resources are released
                ReloadableEntityManagerFactory remf = ((ReloadableEntityManagerFactory) object);
                remf.close();
                persistenceClassLoaderHandler.destroy(unitInfo.id);
View Full Code Here

            }
        }

        for (String sId : moduleIds) {
            try {
                globalContext.unbind(VALIDATOR_FACTORY_NAMING_CONTEXT + sId);
                globalContext.unbind(VALIDATOR_NAMING_CONTEXT + sId);
            } catch (NamingException e) {
                undeployException.getCauses().add(new Exception("validator: " + sId + ": " + e.getMessage(), e));
            }
        }
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.