Package javax.naming

Examples of javax.naming.NamingException


          " -> obj = " + obj);
      return (NamingContext)obj;
    } catch (IOException exc) {
      if (Trace.logger.isLoggable(BasicLevel.DEBUG))
        Trace.logger.log(BasicLevel.DEBUG, "", exc);
      NamingException ne = new NamingException(exc.getMessage());
      ne.setRootCause(exc);
      throw ne;
    } catch (ClassNotFoundException exc2) {
      if (Trace.logger.isLoggable(BasicLevel.DEBUG))
        Trace.logger.log(BasicLevel.DEBUG, "", exc2);
      NamingException ne = new NamingException(exc2.getMessage());
      ne.setRootCause(exc2);
      throw ne;
    }   
  }
View Full Code Here


                try {
                    return NamingManager.getObjectInstance(thisValue,
                            new CompositeName().add(thisName), this,
                            this.environment);
                } catch (Exception e) {
                    NamingException ne = new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                            .getString("WinstoneContext.FailedToGetInstance"));
                    ne.setRootCause(e);
                    throw ne;
                }
            }

            else if (thisValue == null)
View Full Code Here

        // parent
        if (bindName == null)
            this.parent.bind(name, value, allowOverwrites);
        // If empty name, complain - we should have a child name here
        else if (bindName.isEmpty())
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                    "WinstoneContext.AlreadyExists", name.toString()));
        else if (bindName.size() > 1) {
            Object ctx = lookup(bindName.get(0));
            if (!(ctx instanceof Context))
                throw new NotContextException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NotContext", new String[] {
                                bindName.get(0), ctx.getClass().getName() }));
            else if (ctx == null)
                throw new NameNotFoundException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NameNotFound", bindName.get(0)));
            else
                try {
                    if (allowOverwrites)
                        ((Context) ctx).rebind(bindName.getSuffix(1), value);
                    else
                        ((Context) ctx).bind(bindName.getSuffix(1), value);
                } finally {
                    ((Context) ctx).close();
                }
        } else if ((!allowOverwrites) && this.bindings.get(name.get(0)) != null)
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                    "WinstoneContext.AlreadyExists", name.toString()));
        else {
            value = NamingManager.getStateToBind(value, new CompositeName()
                    .add(bindName.get(0)), this, this.environment);
            synchronized (this.contextLock) {
View Full Code Here

        // parent
        if (unbindName == null)
            this.parent.unbind(name);
        // If empty name, complain - we should have a child name here
        else if (unbindName.isEmpty())
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                    .getString("WinstoneContext.CantUnbindEmptyName"));
        else if (unbindName.size() > 1) {
            Object ctx = lookup(unbindName.get(0));
            if (!(ctx instanceof Context))
                throw new NotContextException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NotContext", new String[] {
                                unbindName.get(0), ctx.getClass().getName() }));
            else if (ctx == null)
                throw new NameNotFoundException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NameNotFound", unbindName.get(0)));
            else
                try {
                    ((Context) ctx).unbind(unbindName.getSuffix(1));
                } finally {
                    ((Context) ctx).close();
                }
        } else if (this.bindings.get(name.get(0)) == null)
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                    "WinstoneContext.NameNotFound", name.toString()));
        else {
            synchronized (this.contextLock) {
                // Object removing = this.bindings.get(unbindName.get(0));
                this.bindings.remove(unbindName.get(0));
View Full Code Here

        // parent
        if (childName == null)
            return this.parent.createSubcontext(name);
        // If empty name, complain - we should have a child name here
        else if (childName.isEmpty())
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                    "WinstoneContext.AlreadyExists", name.toString()));
        else if (childName.size() > 1) {
            Object ctx = lookup(childName.get(0));
            if (!(ctx instanceof Context))
                throw new NotContextException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NotContext", new String[] {
                                childName.get(0), ctx.getClass().getName() }));
            else if (ctx == null)
                throw new NameNotFoundException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.NameNotFound", childName.get(0)));
            else
                try {
                    ((Context) ctx).createSubcontext(childName.getSuffix(1));
                } finally {
                    ((Context) ctx).close();
                }
        }

        Context childContext = null;
        synchronized (this.contextLock) {
            if (this.bindings.get(childName.get(0)) != null)
                throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES.getString(
                        "WinstoneContext.AlreadyExists", childName.get(0)));
            else {
                childContext = new WinstoneContext(this.environment, this,
                        this.myAbsoluteName + "/" + childName.get(0),
                        new Boolean(true));
View Full Code Here

        // If absolutely referring to this context, tell the parent to delete this context
        else if (childName.isEmpty()) {
            if (!name.isEmpty())
                this.parent.destroySubcontext(name.getSuffix(name.size() - 2));
            else
                throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                        .getString("WinstoneContext.CantDestroyEmptyName"));
        } else if (childName.size() > 1) {
            Object ctx = lookup(childName.get(0));
            if (!(ctx instanceof Context))
                throw new NotContextException(ContainerJNDIManager.JNDI_RESOURCES.getString(
View Full Code Here

        this.nameEnumeration = null;
    }

    public boolean hasMore() throws NamingException {
        if (this.nameEnumeration == null)
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                    .getString("WinstoneNameEnumeration.AlreadyClosed"));
        else
            return this.nameEnumeration.hasMoreElements();
    }
View Full Code Here

        this.contextEnvironment = environment;
    }

    public Object next() throws NamingException {
        if (this.nameEnumeration == null)
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                    .getString("WinstoneBindingEnumeration.AlreadyClosed"));

        String name = (String) this.nameEnumeration.nextElement();
        Object value = this.bindings.get(name);
        try {
            value = NamingManager.getObjectInstance(value, new CompositeName()
                    .add(name), this.context, this.contextEnvironment);
        } catch (Throwable err) {
            NamingException errNaming = new NamingException(
                    ContainerJNDIManager.JNDI_RESOURCES
                            .getString("WinstoneBindingEnumeration.FailedToGetInstance"));
            errNaming.setRootCause(err);
            throw errNaming;
        }
        return new Binding(name, value);
    }
View Full Code Here

        return new Binding(name, value);
    }

    public boolean hasMore() throws NamingException {
        if (this.nameEnumeration == null)
            throw new NamingException(ContainerJNDIManager.JNDI_RESOURCES
                    .getString("WinstoneBindingEnumeration.AlreadyClosed"));
        else
            return this.nameEnumeration.hasMoreElements();
    }
View Full Code Here

         try
         {
            Object o = crtContext.lookup(tok);
            if (!(o instanceof Context))
            {
               throw new NamingException("Path " + path + " overwrites and already bound object");
            }
            crtContext = (Context)o;
            continue;
         }
         catch(NameNotFoundException e)
View Full Code Here

TOP

Related Classes of javax.naming.NamingException

Copyright © 2018 www.massapicom. 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.