throw new JBossJMSException("JNDI failure", e);
throw new MessagingJMSException("JNDI failure", e);
   public String registerDestination(boolean isQueue, String name, String jndiName,                                     Element securityConfiguration) throws JMSException   {                  String parentContext;      String jndiNameInContext;      if (jndiName == null)      {         parentContext = isQueue ?            serverPeer.getDefaultQueueJNDIContext() : serverPeer.getDefaultTopicJNDIContext();         jndiNameInContext = name;         jndiName = parentContext + "/" + jndiNameInContext;      }      else      {         // TODO more solid parsing + test cases         int sepIndex = jndiName.lastIndexOf('/');         if (sepIndex == -1)         {            parentContext = "";         }         else         {            parentContext = jndiName.substring(0, sepIndex);         }         jndiNameInContext = jndiName.substring(sepIndex + 1);      }      try      {         initialContext.lookup(jndiName);         throw new InvalidDestinationException("Destination " + name + " already exists");      }      catch(NameNotFoundException e)      {         // OK      }      catch(Exception e)      {         e.printStackTrace();         throw new JBossJMSException("JNDI failure", e);      }      Destination jmsDestination =         isQueue ? (Destination) new JBossQueue(name) : (Destination) new JBossTopic(name);      try      {         Context c = JNDIUtil.createContext(initialContext, parentContext);         c.rebind(jndiNameInContext, jmsDestination);         if (isQueue)         {            queueNameToJNDI.put(name, jndiName);         }         else         {            topicNameToJNDI.put(name, jndiName);         }      }      catch(Exception e)      {         throw new JBossJMSException("JNDI failure", e);      }      // if the destination has no security configuration, then the security manager will always      // use its current default security configuration when requested to authorize requests for      // that destination      if (securityConfiguration != null)      {         serverPeer.getSecurityManager().setSecurityConfig(isQueue, name, securityConfiguration);      }      log.debug((isQueue ? "queue" : "topic") + " " + name +                " registered and bound in JNDI as " + jndiName );      return jndiName;   }