Package javax.naming

Examples of javax.naming.ConfigurationException


            try {
                Class<?> clazz = Class.forName(value);
                _storage = (StorageLayer) clazz.newInstance();
                _storage.configure("StorageLayer", params);
            } catch (ClassNotFoundException e) {
                throw new ConfigurationException("Unable to find class " + value);
            } catch (InstantiationException e) {
                throw new ConfigurationException("Unable to find class " + value);
            } catch (IllegalAccessException e) {
                throw new ConfigurationException("Unable to find class " + value);
            }
        }

        if (_inSystemVM) {
            _storage.mkdirs(_parent);
        }

        _configSslScr = Script.findScript(getDefaultScriptsDir(), "config_ssl.sh");
        if (_configSslScr != null) {
            s_logger.info("config_ssl.sh found in " + _configSslScr);
        }

        _configAuthScr = Script.findScript(getDefaultScriptsDir(), "config_auth.sh");
        if (_configSslScr != null) {
            s_logger.info("config_auth.sh found in " + _configAuthScr);
        }

        _configIpFirewallScr = Script.findScript(getDefaultScriptsDir(), "ipfirewall.sh");
        if (_configIpFirewallScr != null) {
            s_logger.info("_configIpFirewallScr found in " + _configIpFirewallScr);
        }

        createTemplateFromSnapshotXenScript = Script.findScript(getDefaultScriptsDir(),
                "create_privatetemplate_from_snapshot_xen.sh");
        if (createTemplateFromSnapshotXenScript == null) {
            throw new ConfigurationException("create_privatetemplate_from_snapshot_xen.sh not found in "
                    + getDefaultScriptsDir());
        }

        _role = (String) params.get("role");
        if (_role == null) {
            _role = SecondaryStorageVm.Role.templateProcessor.toString();
        }
        s_logger.info("Secondary storage runs in role " + _role);

        _guid = (String) params.get("guid");
        if (_guid == null) {
            throw new ConfigurationException("Unable to find the guid");
        }

        _dc = (String) params.get("zone");
        if (_dc == null) {
            throw new ConfigurationException("Unable to find the zone");
        }
        _pod = (String) params.get("pod");

        _instance = (String) params.get("instance");
View Full Code Here


    public boolean configure(String name, Map<String, Object> params)
            throws ConfigurationException {
     
        _name = (String) params.get("name");
        if (_name == null) {
            throw new ConfigurationException("Unable to find name");
        }
       
        _guid = (String)params.get("guid");
        if (_guid == null) {
            throw new ConfigurationException("Unable to find the guid");
        }
       
        _zoneId = (String) params.get("zoneId");
        if (_zoneId == null) {
            throw new ConfigurationException("Unable to find zone");
        }
       
        _numRetries = 2;

        String ip = (String) params.get("ip");
        if (ip == null) {
            throw new ConfigurationException("Unable to find IP");
        }
       
        String adminuser = (String) params.get("adminuser");
        if (adminuser == null) {
            throw new ConfigurationException("Unable to find admin username");
        }
       
        String adminpass = (String) params.get("adminpass");
        if (adminpass == null) {
            throw new ConfigurationException("Unable to find admin password");
        }              
       
        _niciraNvpApi = createNiciraNvpApi();
        _niciraNvpApi.setControllerAddress(ip);
        _niciraNvpApi.setAdminCredentials(adminuser,adminpass);
View Full Code Here

            if ("guest".equalsIgnoreCase(traffType)) {
                _frontEndTrafficType = TrafficType.Guest;
            } else if ("public".equalsIgnoreCase(traffType)){
                _frontEndTrafficType = TrafficType.Public;
            } else
                throw new ConfigurationException("Traffic type for front end of load balancer has to be guest or public; found : " + traffType);
        }
        return true;
    }
View Full Code Here

    @Override
    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
        _name = name;
        if (_configDao == null) {
            throw new ConfigurationException(
                    "Unable to get the configuration dao.");
        }

        _vmSnapshotMax = NumbersUtil.parseInt(_configDao.getValue("vmsnapshot.max"), VMSNAPSHOTMAX);
       
View Full Code Here

          _guestNetworkName = (String)params.get("guest.network.device");
          _agentUserName = (String)params.get("agentusername");
          _agentPassword = (String)params.get("agentpassword");
    } catch (Exception e) {
      s_logger.debug("Configure " + _name + " failed", e);
      throw new ConfigurationException("Configure " + _name + " failed, " + e.toString());
    }
   
    if (_podId == null) {
            throw new ConfigurationException("Unable to get the pod");
        }

        if (_ip == null) {
            throw new ConfigurationException("Unable to get the host address");
        }

        if (_username == null) {
            throw new ConfigurationException("Unable to get the username");
        }

        if (_password == null) {
            throw new ConfigurationException("Unable to get the password");
        }

        if (_guid == null) {
            throw new ConfigurationException("Unable to get the guid");
        }
       
        if (_agentUserName == null) {
          throw new ConfigurationException("Unable to get agent user name");
        }
       
        if (_agentPassword == null) {
          throw new ConfigurationException("Unable to get agent password");
        }               
       
    try {
      setupServer();
    } catch (Exception e) {
      s_logger.debug("Setup server failed, ip " + _ip, e);
      throw new ConfigurationException("Unable to setup server");
    }
   
        _conn = new Connection(_ip, _agentUserName, _agentPassword);
        try {
      OvmHost.registerAsMaster(_conn);
      OvmHost.registerAsVmServer(_conn);
      _bridges = OvmBridge.getAllBridges(_conn);
    } catch (XmlRpcException e) {
      s_logger.debug("Get bridges failed", e);
      throw new ConfigurationException("Cannot get bridges on host " + _ip + "," + e.getMessage());
    }
   
    if (_privateNetworkName != null && !_bridges.contains(_privateNetworkName)) {
      throw new ConfigurationException("Cannot find bridge " + _privateNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
    }
   
    if (_publicNetworkName != null && !_bridges.contains(_publicNetworkName)) {
      throw new ConfigurationException("Cannot find bridge " + _publicNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
    }
   
    if (_guestNetworkName != null && !_bridges.contains(_guestNetworkName)) {
      throw new ConfigurationException("Cannot find bridge " + _guestNetworkName + " on host " + _ip + ", all bridges are:" + _bridges);
    }
       
    /* set to false so each time ModifyStoragePoolCommand will re-setup heartbeat*/
    _isHeartBeat = false;
   
View Full Code Here

    _tftpDir = (String)params.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR);
    _cifsUserName = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_USERNAME);
    _cifsPassword = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_PASSWORD);
   
    if (_podId == null) {
        throw new ConfigurationException("No Pod specified");
    }
   
    if (_storageServer == null) {
      throw new ConfigurationException("No stroage server specified");
    }
   
    if (_tftpDir == null) {
      throw new ConfigurationException("No tftp directory specified");
    }
   
    if (_pingDir == null) {
      throw new ConfigurationException("No PING directory specified");
    }
   
    if (_cifsUserName == null || _cifsUserName.equalsIgnoreCase("")) {
      _cifsUserName = "xxx";
    }
   
    if (_cifsPassword == null || _cifsPassword.equalsIgnoreCase("")) {
      _cifsPassword = "xxx";
    }
   
    String pingDirs[]= _pingDir.split("/");
    if (pingDirs.length != 2) {
      throw new ConfigurationException("PING dir should have format like myshare/direcotry, eg: windows/64bit");
    }
    _share = pingDirs[0];
    _dir = pingDirs[1];
   
    com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
   
    s_logger.debug(String.format("Trying to connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
    try {
      sshConnection.connect(null, 60000, 60000);
      if (!sshConnection.authenticateWithPassword(_username, _password)) {
        s_logger.debug("SSH Failed to authenticate");
        throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username,
            "******"));
      }
     
      String cmd = String.format("[ -f /%1$s/pxelinux.0 ] && [ -f /%2$s/kernel ] && [ -f /%3$s/initrd.gz ] ", _tftpDir, _tftpDir, _tftpDir);
      if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) {
        throw new ConfigurationException("Miss files in TFTP directory at " + _tftpDir + " check if pxelinux.0, kernel initrd.gz are here");
      }
     
      SCPClient scp = new SCPClient(sshConnection)
      String prepareScript = "scripts/network/ping/prepare_tftp_bootfile.py";
      String prepareScriptPath = Script.findScript("", prepareScript);
      if (prepareScriptPath == null) {
        throw new ConfigurationException("Can not find prepare_tftp_bootfile.py at " + prepareScriptPath);
      }
      scp.put(prepareScriptPath, "/usr/bin/", "0755");
     
      String userDataScript = "scripts/network/ping/baremetal_user_data.py";
      String userDataScriptPath = Script.findScript("", userDataScript);
      if (userDataScriptPath == null) {
        throw new ConfigurationException("Can not find baremetal_user_data.py at " + userDataScriptPath);
      }
      scp.put(userDataScriptPath, "/usr/bin/", "0755");
     
      return true;
    } catch (Exception e) {
      throw new ConfigurationException(e.getMessage());
    } finally {
      if (sshConnection != null) {
        sshConnection.close();
      }
    }
View Full Code Here

    com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
    try {
      sshConnection.connect(null, 60000, 60000);
      if (!sshConnection.authenticateWithPassword(_username, _password)) {
        s_logger.debug("SSH Failed to authenticate");
        throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username,
            _password));
      }
     
      String script = String.format("python /usr/bin/prepare_tftp_bootfile.py restore %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s %10$s %11$s",
          _tftpDir, cmd.getMac(), _storageServer, _share, _dir, cmd.getTemplate(), _cifsUserName, _cifsPassword, cmd.getIp(), cmd.getNetMask(), cmd.getGateWay());
View Full Code Here

       com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
        try {
            sshConnection.connect(null, 60000, 60000);
            if (!sshConnection.authenticateWithPassword(_username, _password)) {
                s_logger.debug("SSH Failed to authenticate");
                throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username,
                        _password));
            }
           
            String script = String.format("python /usr/bin/prepare_tftp_bootfile.py backup %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s %10$s %11$s",
                    _tftpDir, cmd.getMac(), _storageServer, _share, _dir, cmd.getTemplate(), _cifsUserName, _cifsPassword, cmd.getIp(), cmd.getNetMask(), cmd.getGateWay());
View Full Code Here

            String arg = org.apache.commons.lang.StringUtils.stripEnd(sb.toString(), ";");
           
            sshConnection.connect(null, 60000, 60000);
            if (!sshConnection.authenticateWithPassword(_username, _password)) {
                s_logger.debug("SSH Failed to authenticate");
                throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username,
                        _password));
            }
           
            String script = String.format("python /usr/bin/baremetal_user_data.py '%s'", arg);
            if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) {
View Full Code Here

    public boolean configure(String name, Map<String, Object> params)
            throws ConfigurationException {

        _name = (String) params.get("name");
        if (_name == null) {
            throw new ConfigurationException("Unable to find name");
        }

        _guid = (String)params.get("guid");
        if (_guid == null) {
            throw new ConfigurationException("Unable to find the guid");
        }

        _zoneId = (String) params.get("zoneId");
        if (_zoneId == null) {
            throw new ConfigurationException("Unable to find zone");
        }

        _numRetries = 2;

        String ip = (String) params.get("ip");
        if (ip == null) {
            throw new ConfigurationException("Unable to find IP");
        }

        _bigswitchVnsApi = createBigSwitchVnsApi();
        _bigswitchVnsApi.setControllerAddress(ip);
View Full Code Here

TOP

Related Classes of javax.naming.ConfigurationException

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.