Package javax.naming

Examples of javax.naming.ConfigurationException


            }
            setOrbAndRootContext(orb, corbaloc);

            return parsedUrl.getStringName();
        } catch (MalformedURLException e) {
            throw new ConfigurationException(e.getMessage());
        }
    }
View Full Code Here


        throws Exception
    {
        Entry e = name2entry.get( nextInterceptorName );
        if ( e == null )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_330, nextInterceptorName ) );
        }
        register0( interceptor, e );
    }
View Full Code Here

        throws Exception
    {
        Entry e = name2entry.get( prevInterceptorName );
        if ( e == null )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_330, prevInterceptorName ) );
        }
        register0( interceptor, e.nextEntry );
    }
View Full Code Here

    {
        Entry e = name2entry.get( name );

        if ( e == null )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_331, name ) );
        }

        return e;
    }
View Full Code Here

     */
    private void checkAddable( Interceptor interceptor ) throws ConfigurationException
    {
        if ( name2entry.containsKey( interceptor.getName() ) )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_332, interceptor.getName() ) );
        }
    }
View Full Code Here

            // check a few things to make sure users configured it properly
            // ---------------------------------------------------------------

            if ( ! override.getId().equals( "system" ) )
            {
                throw new ConfigurationException( I18n.err( I18n.ERR_262, override.getId() ) );
            }
           

            system = override;
        }
        else
        {
        }

        system.initialize( );
       
       
        // Add root context entry for system partition
        DN systemSuffixDn = new DN( ServerDNConstants.SYSTEM_DN );
        systemSuffixDn.normalize( schemaManager.getNormalizerMapping() );
        ServerEntry systemEntry = new DefaultServerEntry( schemaManager, systemSuffixDn );

        // Add the ObjectClasses
        systemEntry.put( SchemaConstants.OBJECT_CLASS_AT,
            SchemaConstants.TOP_OC,
            SchemaConstants.ORGANIZATIONAL_UNIT_OC,
            SchemaConstants.EXTENSIBLE_OBJECT_OC
            );
       
        // Add some operational attributes
        systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
        systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
        systemEntry.add( SchemaConstants.ENTRY_CSN_AT, directoryService.getCSN().toString() );
        systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
        systemEntry.put( NamespaceTools.getRdnAttribute( ServerDNConstants.SYSTEM_DN ),
            NamespaceTools.getRdnValue( ServerDNConstants.SYSTEM_DN ) );
        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( schemaManager.getNormalizerMapping() );
        CoreSession adminSession = new DefaultCoreSession(
            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
        AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
       
        if ( !system.hasEntry( new EntryOperationContext( adminSession, systemEntry.getDn() ) ) )
        {
            system.add( addOperationContext );
        }
       
        String key = system.getSuffixDn().getName();
       
        if ( partitions.containsKey( key ) )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_263, key ) );
        }
       
        synchronized ( partitionLookupTree )
        {
            partitions.put( key, system );
View Full Code Here

        // Turn on default indices
        String key = partition.getSuffixDn().getNormName();
       
        if ( partitions.containsKey( key ) )
        {
            throw new ConfigurationException( I18n.err( I18n.ERR_263, key ) );
        }

        if ( ! partition.isInitialized() )
        {
            partition.initialize( );
        }
       
        synchronized ( partitionLookupTree )
        {
            DN partitionSuffix = partition.getSuffixDn();
           
            if ( partitionSuffix == null )
            {
                throw new ConfigurationException( I18n.err( I18n.ERR_267, partition.getId() ) );
            }
           
            partitions.put( partitionSuffix.getNormName(), partition );
            partitionLookupTree.add( partition.getSuffixDn(), partition );
View Full Code Here

        String value = (String) params.get("scripts.timeout");
        _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;

        _modifyVlanPath = Script.findScript(networkScriptsDir, "modifyvlan.sh");
        if (_modifyVlanPath == null) {
            throw new ConfigurationException("Unable to find modifyvlan.sh");
        }

        try {
            createControlNetwork();
        } catch (LibvirtException e) {
            throw new ConfigurationException(e.getMessage());
        }
    }
View Full Code Here

    private Map<String, Object> getDeveloperProperties()
            throws ConfigurationException {
        final File file = PropertiesUtil.findConfigFile("developer.properties");
        if (file == null) {
            throw new ConfigurationException(
                    "Unable to find developer.properties.");
        }

        s_logger.info("developer.properties found at " + file.getAbsolutePath());
        Properties properties = new Properties();
        try {
            properties.load(new FileInputStream(file));

            String startMac = (String) properties.get("private.macaddr.start");
            if (startMac == null) {
                throw new ConfigurationException(
                        "Developers must specify start mac for private ip range");
            }

            String startIp = (String) properties.get("private.ipaddr.start");
            if (startIp == null) {
                throw new ConfigurationException(
                        "Developers must specify start ip for private ip range");
            }
            final Map<String, Object> params = PropertiesUtil.toMap(properties);

            String endIp = (String) properties.get("private.ipaddr.end");
View Full Code Here

            Class<?> clazz = Class
                    .forName("com.cloud.storage.JavaStorageLayer");
            _storage = (StorageLayer) ComponentLocator.inject(clazz);
            _storage.configure("StorageLayer", params);
        } catch (ClassNotFoundException e) {
            throw new ConfigurationException("Unable to find class "
                    + "com.cloud.storage.JavaStorageLayer");
        }


        String domrScriptsDir = (String) params.get("domr.scripts.dir");
        if (domrScriptsDir == null) {
            domrScriptsDir = getDefaultDomrScriptsDir();
        }

        String kvmScriptsDir = (String) params.get("kvm.scripts.dir");
        if (kvmScriptsDir == null) {
            kvmScriptsDir = getDefaultKvmScriptsDir();
        }

        String networkScriptsDir = (String) params.get("network.scripts.dir");
        if (networkScriptsDir == null) {
            networkScriptsDir = getDefaultNetworkScriptsDir();
        }

        String storageScriptsDir = (String) params.get("storage.scripts.dir");
        if (storageScriptsDir == null) {
            storageScriptsDir = getDefaultStorageScriptsDir();
        }

        params.put("domr.scripts.dir", domrScriptsDir);

        _virtRouterResource = new VirtualRoutingResource();
        success = _virtRouterResource.configure(name, params);

        if (!success) {
            return false;
        }

        _host = (String) params.get("host");
        if (_host == null) {
            _host = "localhost";
        }

        _dcId = (String) params.get("zone");
        if (_dcId == null) {
            _dcId = "default";
        }

        _pod = (String) params.get("pod");
        if (_pod == null) {
            _pod = "default";
        }

        _clusterId = (String) params.get("cluster");

        _modifyVlanPath = Script.findScript(networkScriptsDir, "modifyvlan.sh");
        if (_modifyVlanPath == null) {
            throw new ConfigurationException("Unable to find modifyvlan.sh");
        }

        _versionstringpath = Script.findScript(kvmScriptsDir, "versions.sh");
        if (_versionstringpath == null) {
            throw new ConfigurationException("Unable to find versions.sh");
        }

        _patchdomrPath = Script.findScript(kvmScriptsDir + "/patch/",
                "rundomrpre.sh");
        if (_patchdomrPath == null) {
            throw new ConfigurationException("Unable to find rundomrpre.sh");
        }

        _heartBeatPath = Script.findScript(kvmScriptsDir, "kvmheartbeat.sh");
        if (_heartBeatPath == null) {
            throw new ConfigurationException("Unable to find kvmheartbeat.sh");
        }

        _createvmPath = Script.findScript(storageScriptsDir, "createvm.sh");
        if (_createvmPath == null) {
            throw new ConfigurationException("Unable to find the createvm.sh");
        }

        _manageSnapshotPath = Script.findScript(storageScriptsDir,
                "managesnapshot.sh");
        if (_manageSnapshotPath == null) {
            throw new ConfigurationException(
                    "Unable to find the managesnapshot.sh");
        }

        _createTmplPath = Script
                .findScript(storageScriptsDir, "createtmplt.sh");
        if (_createTmplPath == null) {
            throw new ConfigurationException(
                    "Unable to find the createtmplt.sh");
        }

        _securityGroupPath = Script.findScript(networkScriptsDir,
                "security_group.py");
        if (_securityGroupPath == null) {
            throw new ConfigurationException(
                    "Unable to find the security_group.py");
        }

        _routerProxyPath = Script.findScript("scripts/network/domr/",
                "router_proxy.sh");
        if (_routerProxyPath == null) {
            throw new ConfigurationException(
                    "Unable to find the router_proxy.sh");
        }

        String value = (String) params.get("developer");
        boolean isDeveloper = Boolean.parseBoolean(value);

        if (isDeveloper) {
            params.putAll(getDeveloperProperties());
        }

        _pool = (String) params.get("pool");
        if (_pool == null) {
            _pool = "/root";
        }

        String instance = (String) params.get("instance");

        _hypervisorType = (String) params.get("hypervisor.type");
        if (_hypervisorType == null) {
            _hypervisorType = "kvm";
        }

        _hypervisorURI = (String) params.get("hypervisor.uri");
        if (_hypervisorURI == null) {
            _hypervisorURI = "qemu:///system";
        }
        String startMac = (String) params.get("private.macaddr.start");
        if (startMac == null) {
            startMac = "00:16:3e:77:e2:a0";
        }

        String startIp = (String) params.get("private.ipaddr.start");
        if (startIp == null) {
            startIp = "192.168.166.128";
        }

        _pingTestPath = Script.findScript(kvmScriptsDir, "pingtest.sh");
        if (_pingTestPath == null) {
            throw new ConfigurationException("Unable to find the pingtest.sh");
        }

        _linkLocalBridgeName = (String) params.get("private.bridge.name");
        if (_linkLocalBridgeName == null) {
            if (isDeveloper) {
                _linkLocalBridgeName = "cloud-" + instance + "-0";
            } else {
                _linkLocalBridgeName = "cloud0";
            }
        }

        _publicBridgeName = (String) params.get("public.network.device");
        if (_publicBridgeName == null) {
            _publicBridgeName = "cloudbr0";
        }

        _privBridgeName = (String) params.get("private.network.device");
        if (_privBridgeName == null) {
            _privBridgeName = "cloudbr1";
        }

        _guestBridgeName = (String) params.get("guest.network.device");
        if (_guestBridgeName == null) {
            _guestBridgeName = _privBridgeName;
        }

        _privNwName = (String) params.get("private.network.name");
        if (_privNwName == null) {
            if (isDeveloper) {
                _privNwName = "cloud-" + instance + "-private";
            } else {
                _privNwName = "cloud-private";
            }
        }

        _localStoragePath = (String) params.get("local.storage.path");
        if (_localStoragePath == null) {
            _localStoragePath = "/var/lib/libvirt/images/";
        }

        _localStorageUUID = (String) params.get("local.storage.uuid");
        if (_localStorageUUID == null) {
            throw new ConfigurationException("local.storage.uuid is not set! Please set this to a valid UUID");
        }

        value = (String) params.get("scripts.timeout");
        _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;

        value = (String) params.get("stop.script.timeout");
        _stopTimeout = NumbersUtil.parseInt(value, 120) * 1000;

        value = (String) params.get("cmds.timeout");
        _cmdsTimeout = NumbersUtil.parseInt(value, 7200) * 1000;

        value = (String) params.get("host.reserved.mem.mb");
        _dom0MinMem = NumbersUtil.parseInt(value, 0) * 1024 * 1024;

        LibvirtConnection.initialize(_hypervisorURI);
        Connect conn = null;
        try {
            conn = LibvirtConnection.getConnection();
        } catch (LibvirtException e) {
            throw new CloudRuntimeException(e.getMessage());
        }

        /* Does node support HVM guest? If not, exit */
        if (!IsHVMEnabled(conn)) {
            throw new ConfigurationException(
                    "NO HVM support on this machine, please make sure: "
                            + "1. VT/SVM is supported by your CPU, or is enabled in BIOS. "
                            + "2. kvm modules are loaded (kvm, kvm_amd|kvm_intel)");
        }

        _hypervisorPath = getHypervisorPath(conn);
        try {
            _hvVersion = conn.getVersion();
            _hvVersion = (_hvVersion % 1000000) / 1000;
        } catch (LibvirtException e) {

        }

        String[] info = NetUtils.getNetworkParams(_privateNic);

        _monitor = new KVMHAMonitor(null, info[0], _heartBeatPath);
        Thread ha = new Thread(_monitor);
        ha.start();

        _storagePoolMgr = new KVMStoragePoolManager(_storage, _monitor);

        _sysvmISOPath = (String) params.get("systemvm.iso.path");
        if (_sysvmISOPath == null) {
            String[] isoPaths = { "/usr/lib64/cloud/agent/vms/systemvm.iso",
                    "/usr/lib/cloud/agent/vms/systemvm.iso",
                    "/usr/lib64/cloud/common/vms/systemvm.iso",
                    "/usr/lib/cloud/common/vms/systemvm.iso" };
            for (String isoPath : isoPaths) {
                if (_storage.exists(isoPath)) {
                    _sysvmISOPath = isoPath;
                    break;
                }
            }
            if (_sysvmISOPath == null) {
                s_logger.debug("Can't find system vm ISO");
            }
        }

        getPifs();
        if (_pifs.get("private") == null) {
            s_logger.debug("Failed to get private nic name");
            throw new ConfigurationException("Failed to get private nic name");
        }

        if (_pifs.get("public") == null) {
            s_logger.debug("Failed to get public nic name");
            throw new ConfigurationException("Failed to get public nic name");
        }
        s_logger.debug("Found pif: " + _pifs.get("private") + " on " + _privBridgeName
                + ", pif: " + _pifs.get("public") + " on " + _publicBridgeName);


        _can_bridge_firewall = can_bridge_firewall(_pifs.get("public"));

        _localGateway = Script
                .runSimpleBashScript("ip route |grep default|awk '{print $3}'");
        if (_localGateway == null) {
            s_logger.debug("Failed to found the local gateway");
        }

        _mountPoint = (String) params.get("mount.path");
        if (_mountPoint == null) {
            _mountPoint = "/mnt";
        }
       
        value = (String) params.get("vm.migrate.speed");
        _migrateSpeed = NumbersUtil.parseInt(value, -1);
        if (_migrateSpeed == -1) {
            //get guest network device speed
            _migrateSpeed = 0;
            String speed = Script.runSimpleBashScript("ethtool " + _pifs.get("public") + " |grep Speed | cut -d \\  -f 2");
            if (speed != null) {
                String[] tokens = speed.split("M");
                if (tokens.length == 2) {
                    try {
                        _migrateSpeed = Integer.parseInt(tokens[0]);
                    } catch (Exception e) {
                       
                    }
                    s_logger.debug("device " + _pifs.get("public") + " has speed: " + String.valueOf(_migrateSpeed));
                }
            }
            params.put("vm.migrate.speed", String.valueOf(_migrateSpeed));
        }

        Map<String, String> bridges = new HashMap<String, String>();
        bridges.put("linklocal", _linkLocalBridgeName);
        bridges.put("public", _publicBridgeName);
        bridges.put("private", _privBridgeName);
        bridges.put("guest", _guestBridgeName);

        params.put("libvirt.host.bridges", (Object) bridges);
        params.put("libvirt.host.pifs", (Object) _pifs);

        // Load the vif driver
        String vifDriverName = (String) params.get("libvirt.vif.driver");
        if (vifDriverName == null) {
          s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver.");
          vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver";
        }

        params.put("libvirt.computing.resource", (Object) this);

        try {
          Class<?> clazz = Class.forName(vifDriverName);
          _vifDriver = (VifDriver) clazz.newInstance();
          _vifDriver.configure(params);
        } catch (ClassNotFoundException e) {
          throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e);
        } catch (InstantiationException e) {
          throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e);
        } catch (Exception e) {
          throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e);
        }


        return true;
    }
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.