Package javax.naming

Examples of javax.naming.NamingException


      logger.error("[getHomeObject] There are classpath/classloader issues.  I can't do Class.forName(" + homeClassName + ");", e);
      // This kinda sucks, because you are losing information.
      // but for now it wasn't worthwhile for me to go through and make sure
      // ClassNotFoundException was also handled in some way by all the calling
      // classes.
      throw new NamingException("ClassNotFoundException!");
    }
    homeObject = homeCache.getHome(homeClass);
    if (homeObject == null) {
      Object tmpObj = Settings.getInstance().getInitCtx().lookup(beanJndiName);
      homeObject = PortableRemoteObject.narrow(tmpObj, homeClass);
View Full Code Here


                    logger.error("Could not reset resource \""+resourceName+"\"", e);
                }
            }
            return false;
        } catch (MalformedObjectNameException e) {
            throw new NamingException("Resource name: \""+resourceName + "\" makes a malformed ObjectName");
        }
    }
View Full Code Here

        try {
          Class factoryClass = Class.forName(factoryClassName);
          namingFactory =
            (InitialContextFactory)factoryClass.newInstance();
        } catch (Exception exc) {
          NamingException ne = new NamingException();
          ne.setRootCause(exc);
          throw ne;
        }
      }
    }
  }
View Full Code Here

      }
   
      if (url != null) {
        StringTokenizer tokenizer = new StringTokenizer(url, "/:,");
        if (! tokenizer.hasMoreElements())
          throw new NamingException("URL not valid:" + url);
        String protocol = tokenizer.nextToken();       
        if (protocol.equals("hascn")) {
          HANamingConnection haNamingConnection =
            new HANamingConnection();
          while (tokenizer.hasMoreElements()) {
            haNamingConnection.addServerAddress(
              tokenizer.nextToken(),
              Integer.parseInt(tokenizer.nextToken()));
          }
          namingConnection = haNamingConnection;
        } else {
          throw new NamingException("Unknown protocol:" + protocol);
        }
      } else {
        throw new NamingException(
          "URL " + Context.PROVIDER_URL + " not defined");
      }
      return namingConnection;
    } catch (Exception e) {
      NamingException nx =
        new NamingException(
          "exception creating NamingContext: " +
          e.toString());
      nx.setRootCause(e);
      throw nx;
    }
  }
View Full Code Here

      return (JndiReply)ioCtrl.readObject();
    } catch (IOException ioe) {
      if (Trace.logger.isLoggable(BasicLevel.ERROR))
        Trace.logger.log(BasicLevel.ERROR,
                         "SimpleNamingConnection.receive()", ioe);
      NamingException ne = new NamingException(ioe.getMessage());
      ne.setRootCause(ioe);
      throw ne;
    } catch (ClassNotFoundException cnfe) {
      if (Trace.logger.isLoggable(BasicLevel.ERROR))
        Trace.logger.log(BasicLevel.ERROR,
                         "SimpleNamingConnection.receive()", cnfe);
      NamingException ne = new NamingException(cnfe.getMessage());
      ne.setRootCause(cnfe);
      throw ne;
    } finally {
      ioCtrl.close();
    }
  }
View Full Code Here

        ioCtrl.writeObject(request);
        return (JndiReply)ioCtrl.readObject();
      } catch (IOException ioe) {
        if (Trace.logger.isLoggable(BasicLevel.ERROR))
          Trace.logger.log(BasicLevel.ERROR, "NamingConnection.receive()", ioe);
        NamingException ne = new NamingException(ioe.getMessage());
        ne.setRootCause(ioe);
        throw ne;
      } catch (ClassNotFoundException cnfe) {
        if (Trace.logger.isLoggable(BasicLevel.ERROR))
          Trace.logger.log(BasicLevel.ERROR, "NamingConnection.receive()", cnfe);
        NamingException ne = new NamingException(cnfe.getMessage());
        ne.setRootCause(cnfe);
        throw ne;
      } finally {
        close();
      }
    }
View Full Code Here

      ioCtrl = new IOControl(socket);
    } catch (IOException exc) {
      if (Trace.logger.isLoggable(BasicLevel.DEBUG))
        Trace.logger.log(BasicLevel.DEBUG,
                         "SimpleNamingConnection.open()", exc);
      NamingException exc2 = new NamingException(exc.getMessage());
      exc2.setRootCause(exc);
      throw exc2;
    }
  }
View Full Code Here

        addresses.removeElementAt(0);
        addresses.addElement(sa);
      }
      i++;
    }   
    NamingException exc2 =
      new NamingException("Connection failed with all replicas: " +
                          addresses);
    throw exc2;
  }
View Full Code Here

      if (url == null)
        url = (String) env.get(Context.PROVIDER_URL);
      if (url != null && !url.equals("")) {
        StringTokenizer tokenizer = new StringTokenizer(url, "/:,");
        if (! tokenizer.hasMoreElements())
          throw new NamingException("URL not valid:" + url);
        String protocol = tokenizer.nextToken();       
        if (protocol.equals("scn")) {
          host = tokenizer.nextToken();
          String portStr = tokenizer.nextToken();
          port = Integer.parseInt(portStr);
        } else {
          throw new NamingException("Unknown protocol:" + protocol);
        }
      } else {       
        host = (String) env.get(SCN_HOST_PROPERTY);
        if (host == null)
          host = System.getProperty(SCN_HOST_PROPERTY);
        if (host == null)
          host = (String) env.get(JAVA_HOST_PROPERTY);
        if (host == null)
          host = System.getProperty(JAVA_HOST_PROPERTY);
        if (host == null)
          host = "localhost";

        String portStr = (String) env.get(SCN_PORT_PROPERTY);
        if (portStr == null)
          portStr = System.getProperty(SCN_PORT_PROPERTY);
        if (portStr == null)
          portStr = (String) env.get(JAVA_PORT_PROPERTY);
        if (portStr == null)
          portStr = System.getProperty(JAVA_PORT_PROPERTY);
        if (portStr == null)
          portStr = "16400";

        port = Integer.parseInt(portStr);
      }

      SimpleNamingConnection namingConnection = new SimpleNamingConnection(host, port, env);
      namingConnection.init(host, port, env);

      return namingConnection;
    } catch (NumberFormatException e) {
      NamingException nx = new NamingException();
      nx.setRootCause(e);
      throw nx;
    } catch (Exception e) {
      NamingException nx = new NamingException();
      nx.setRootCause(e);
      throw nx;
    }
  }
View Full Code Here

      obj = ((Referenceable)obj).getReference();
    }
    JndiReply reply = connection.invoke(
      new BindRequest(merge(contextPath, name), obj));
    if (reply instanceof JndiError) {
      NamingException exc = ((JndiError)reply).getException();
      exc.fillInStackTrace();
      throw exc;
    }
  }
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.