Package javax.naming

Examples of javax.naming.NamingException


            }
        }

        // No context found. This is outside of a j2ee component or server
        // component.
        throw new NamingException("No java: context for components running outside EasyBeans.");
    }
View Full Code Here


                if (useSmartInfoByClassLoader) {
                    infosClassLoader.put(Thread.currentThread().getContextClassLoader(), info);
                }

            } catch (Exception e) {
                NamingException ne = new NamingException("Cannot get a remote ClassLoader");
                ne.initCause(e);
                throw ne;
            }
        }

        return info;
View Full Code Here

                portNumber = new Integer(pts).intValue();
            }
            return portNumber;
        } catch (Exception e) {
            // don't rethrow original exception. only URL name is important
            throw new NamingException("Invalid URL '" + url + "'. It should be on the format <protocol>://<hostname>:<port>");
        }
    }
View Full Code Here

            // Get last element of the array to get hostname
            host = tmpSplitHost[tmpSplitHost.length - 1];
        } catch (Exception e) {
            // don't rethrow original exception. only URL name is important
            throw new NamingException("Invalid URL '" + url + "'. It should be on the format <protocol>://<hostname>:<port>");
        }
        return host;
    }
View Full Code Here

            InitialContext ictx = new InitialContext();
            RefAddr ra = ((Reference) ret).get(0);
            try {
                ret = ictx.lookup((String) ra.getContent());
            } catch (Exception e) {
                NamingException ne = new NamingException(e.getMessage());
                ne.setRootCause(e);
                logger.error("unexpected exception {0}", e.getMessage(), e);
                throw ne;
            }
        } else if (ret instanceof Reference) {
            // Use NamingManager to build an object
            try {
                Object o = javax.naming.spi.NamingManager.getObjectInstance(ret, n, this, this.environment);
                ret = o;
            } catch (NamingException e) {
                throw e;
            } catch (Exception e) {
                NamingException ne = new NamingException(e.getMessage());
                ne.setRootCause(e);
                throw ne;
            }
            if (ret == null) {
                logger.error("Can not build an object with the reference {0}", name);
                throw new NamingException("Can not build an object with the reference '" + name + "'");
            }
        }
        return ret;

    }
View Full Code Here

        // Get the class name
        String clname = ref.getClassName();

        // Check the class name
        if (!ref.getClassName().equals(FACTORY_TYPE)) {
            throw new NamingException("Cannot create object : required type is '" + FACTORY_TYPE + "', but found type is '"
                    + clname + "'.");
        }

        URL url = null;
        String urlString = (String) ref.get("url").getContent();

        if (urlString != null) {
            try {
                url = new URL(urlString);
            } catch (MalformedURLException e) {
                NamingException ne = new NamingException("Cannot build an URL with the given string '" + urlString + "'");
                ne.initCause(e);
                throw ne;
            }
        } else {
            throw new NamingException("Can not build an object as no URL was given.");
        }

        return url;
    }
View Full Code Here

               c = Class.forName(icfName);
            }
            catch(ClassNotFoundException e)
            {
               log.error("\"" + icfName + "\" cannot be loaded", e);
               throw new NamingException("\"" + icfName + "\" cannot be loaded");
            }

            try
            {
               icf = (InitialContextFactory)c.newInstance();
            }
            catch(InstantiationException e)
            {
               log.error(c.getName() + " cannot be instantiated", e);
               throw new NamingException(c.getName() + " cannot be instantiated");
            }
            catch(IllegalAccessException e)
            {
               log.error(c.getName() + " instantiation generated an IllegalAccessException", e);
               throw new NamingException(c.getName() +
                  " instantiation generated an IllegalAccessException");
            }
         }
      }
View Full Code Here

         // ... then in the global environment
         s = System.getProperty(Constants.SERVER_INDEX_PROPERTY_NAME);

         if (s == null)
         {
            throw new NamingException("Cannot figure out server index!");
         }
      }

      int serverIndex;

      try
      {
         serverIndex = Integer.parseInt(s);
      }
      catch(Exception e)
      {
         throw new NamingException("Failure parsing \"" +
                                   Constants.SERVER_INDEX_PROPERTY_NAME +"\". " +
                                   s + " is not an integer");
      }

      int size = initialContexts.size();
View Full Code Here

         return new RemoteContext(remoteServerIndex);
      }
      catch(Exception e)
      {
         log.error("Cannot get the remote context", e);
         throw new NamingException("Cannot get the remote context");
      }

   }
View Full Code Here

         {
            return ((InVMContext)lookup(contextName)).listBindings("");
         }
         catch(Throwable t)
         {
            throw new NamingException(t.getMessage());
         }
      }

      List l = new ArrayList();
      for(Iterator i = map.keySet().iterator(); i.hasNext(); )
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.