Example usage for org.apache.commons.configuration ConfigurationException printStackTrace

List of usage examples for org.apache.commons.configuration ConfigurationException printStackTrace

Introduction

In this page you can find the example usage for org.apache.commons.configuration ConfigurationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Usage

From source file:eu.optimis.mi.aggregator.resources.AggregatorResource.java

public AggregatorResource() {
    try {//ww w  .  j  av a2 s .  c  om
        PropertyConfigurator.configure(ConfigManager.getConfigFilePath(ConfigManager.LOG4J_CONFIG_FILE));

        PropertiesConfiguration configAgt = ConfigManager
                .getPropertiesConfiguration(ConfigManager.AGGREGATOR_CONFIG_FILE);
        servicePath = configAgt.getString("resource.service.path");
        physicalPath = configAgt.getString("resource.physical.path");
        virtualPath = configAgt.getString("resource.virtual.path");
        energyPath = configAgt.getString("resource.energy.path");
    } catch (IOException e) {
        logger.error("couldn't find the configuration file");
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (ConfigurationException e1) {
        logger.error("couldn't find the properties defined in the configuration file");
        e1.printStackTrace();
        throw new RuntimeException(e1);
    }
}

From source file:com.nilostep.xlsql.database.xlInstance.java

private xlInstance(String cfg) throws xlException {
    logger = Logger.getLogger(this.getClass().getName());
    instance = this;

    try {//w ww.j a va2 s.com
        PropertiesConfiguration config = new PropertiesConfiguration();
        config.load(this.getClass().getResourceAsStream(cfg + ".properties"));
        this.config = config;

        engine = config.getString("general.engine");

        logger.info("Configuration engine: " + engine + " loaded");
    } catch (ConfigurationException e) {
        e.printStackTrace();
        throw new xlException(e.getMessage());
    }

    try {
        boolean append = true;
        FileHandler loghandler = new FileHandler(getLog(), append);
        loghandler.setFormatter(new SimpleFormatter());
        logger.addHandler(loghandler);
    } catch (IOException e) {
        throw new xlException("error while creating logfile");
    }

    logger.info("Instance created with engine " + getEngine());
}

From source file:gda.gui.microfocus.camera.PixelToMMConverter.java

@Override
public void configure() throws FactoryException {
    try {/*from  w  w  w  .  j a  v a2s  . co  m*/
        config = LocalParameters.getXMLConfiguration(name);
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    this.load();

}

From source file:gda.gui.microfocus.camera.PixelToMMConverter.java

/**
 *  Save the parameters to a file// www  .  j a  v a2 s  .  c om
 */
public void save() {
    try {

        config.setProperty(nameElement, name);
        config.setProperty(expressionElement, expression);
        config.setProperty(pixelReferenceElement, this.pixelReference);
        config.setProperty(mmPerPixelElement, this.mmPerPixel);
        config.setProperty(mmOffsetElement, this.mmOffset);
        config.save();

    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:eu.optimis.mi.gui.server.MonitoringManagerWebServiceImpl.java

public MonitoringManagerWebServiceImpl() {
    logger.info("Monitoring Manager Web Service is ready.");

    try {/*from w  ww. j av a2s. c  o  m*/
        PropertyConfigurator.configure(ConfigManager.getConfigFilePath(ConfigManager.LOG4J_CONFIG_FILE));
        PropertiesConfiguration config = ConfigManager
                .getPropertiesConfiguration(ConfigManager.MMEB_CONFIG_FILE);
        MMANAGER_URL = config.getString("mmanager.url");
    } catch (IOException e) {
        logger.error("couldn't find the configuration file, using default url");
        e.printStackTrace();
        MMANAGER_URL = "http://localhost:8080/MonitoringManager/";
        //throw new RuntimeException(e);
    } catch (ConfigurationException e1) {
        logger.error("couldn't find the properties defined in the configuration file, using default url");
        e1.printStackTrace();
        MMANAGER_URL = "http://localhost:8080/MonitoringManager/";
        //throw new RuntimeException(e1);
    }
}

From source file:com.opensoc.test.AbstractConfigTest.java

protected void setUp(String configName) throws Exception {
    super.setUp();
    this.setConfigPath("src/test/resources/config/" + getClass().getSimpleName() + ".config");
    try {//from w  ww. j  a va2 s .  co  m
        this.setConfig(new PropertiesConfiguration(this.getConfigPath()));

        Map configOptions = SettingsLoader.getConfigOptions((PropertiesConfiguration) this.config,
                configName + "=");
        this.setSettings(
                SettingsLoader.getConfigOptions((PropertiesConfiguration) this.config, configName + "."));
        this.getSettings().put(configName, (String) configOptions.get(configName));
    } catch (ConfigurationException e) {
        fail("Config not found !!" + e);
        e.printStackTrace();
    }
}

From source file:io.dockstore.common.FileProvisioning.java

/**
 * Constructor//w  w w  . j a va2s . co  m
 */
public FileProvisioning(String configFile) {
    // do not forward stdout and stderr
    stdoutStream = Optional.absent();
    stderrStream = Optional.absent();

    try {
        this.config = new HierarchicalINIConfiguration(configFile);
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:lp.reminiscens.crawler.FlickrToURL.java

public FlickrToURL() {

    FlickrSearchQuery_url = "http://api.flickr.com/services/rest/?method=flickr.photos.search";
    FlickrGetLocationQuery_url = "http://api.flickr.com/services/rest/?method=flickr.photos.geo.getLocation";

    FlickrGetLocationQuery_id = "&photo_id=";
    FlickrQuery_per_page = "&per_page=100";
    seconds = "+00:00:00";
    FlickrExtraQuery = "&extras=";
    FlickrExtraGeo = "geo";
    FlickrExtraTags = "tags";
    FlickrExtraTakenDate = "date_taken";
    FlickrExtraUploadDate = "date_upload";
    FlickrMin_Taken_Date = "&min_taken_date=";
    FlickrMax_Taken_Date = "&max_taken_date=";
    FlickrQuery_nojsoncallback = "&nojsoncallback=1";
    FlickrQuery_format = "&format=json";
    FlickrQuery_license = "&license=1%2C2%2C4%2C5%2C7"; // creative commons
    FlickrQuery_tag = "&tags=";
    FlickrQuery_key = "&api_key=";

    try {// w  ww .j  a v  a  2s .  c  om
        Configuration config = new PropertiesConfiguration("lifecontext.utils.config");
        FlickrApiKey = config.getProperty("flickr.apikey").toString();
    } catch (ConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    photos = new HashSet<Media>();
}

From source file:com.sinfonier.util.XMLProperties.java

/**
 * Simple XMLProperties Constructor/*from  w w w .j a va 2s .  c  o  m*/
 * 
 * @param xmlPath Path to XML file
 * @param type ComponentType
 */
public XMLProperties(ComponentType type, String xmlPath) {
    this.componentType = type;
    try {
        xml = new XMLConfiguration(xmlPath);
        xml.setDefaultListDelimiter((char) 0);
        xml.setExpressionEngine(new XPathExpressionEngine());
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:com.sinfonier.util.XMLProperties.java

/**
 * Constructor//from w  ww  . j  a  v a  2 s . co  m
 * 
 * @param componentName Name of the component
 * @param type ComponentType
 * @param xmlPath Path to XML file
 */
public XMLProperties(String componentName, ComponentType type, String xmlPath) {
    this.componentName = componentName;
    this.componentType = type;
    try {
        xml = new XMLConfiguration(xmlPath);
        xml.setDefaultListDelimiter((char) 0);
        xml.setExpressionEngine(new XPathExpressionEngine());

    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}