Example usage for java.lang ExceptionInInitializerError ExceptionInInitializerError

List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError

Introduction

In this page you can find the example usage for java.lang ExceptionInInitializerError ExceptionInInitializerError.

Prototype

public ExceptionInInitializerError(String s) 

Source Link

Document

Constructs an ExceptionInInitializerError with the specified detail message string.

Usage

From source file:com.idega.hibernate.HibernateUtil.java

public static SessionFactory configure() {
    try {/*  w  ww.j ava2 s  .  c  o m*/
        Logger loggerRoot = Logger.getLogger(HibernateUtil.class.getName());
        Logger loggerConnect = Logger.getLogger("Connect");

        loggerRoot.fine("In HibernateUtil try-clause");
        loggerRoot.warning("In HibernateUtil try-clause");
        loggerConnect.fine("In HibernateUtil try-clause via loggerConnect DEBUG*****");

        // Create the SessionFactory from hibernate.cfg.xml
        Properties properties = getProperties();

        Configuration configuration = new Configuration();
        configuration.setProperties(properties);
        return configuration.buildSessionFactory();
    } catch (Throwable ex) {
        // Make sure you log the exception, as it might be swallowed
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}

From source file:org.string_db.jdbc.DriverDataSourceConfig.java

@Override
@Bean //need to repeat the annotation
public DataSource dataSource() {
    if (!env.containsProperty("jdbc.url")) {
        throw new ExceptionInInitializerError("missing property 'jdbc.url' " + env);
    }//from www. j  av a2  s  .c om
    return new DriverManagerDataSource(env.getProperty("jdbc.url"), env.getProperty("jdbc.username"),
            env.getProperty("jdbc.password"));
}

From source file:library.functions.BaseFunctions.java

public BaseFunctions() {
    try {/*from w ww.  j  a v  a  2 s .co m*/
        rxml = new ReadXmlData();
        browser = getData().commonData("browser");
        remoteUrl = getData().commonData("remoteUrl");

        urlString = getData().commonData("url");
        record = Boolean.valueOf(getData().commonData("record"));

    } catch (Throwable e) {
        throw new ExceptionInInitializerError(e);
    }
}

From source file:com.rajesh.common.BaseHibernateTest.java

protected SessionFactory getSessionFactory() {
    try {/*from w  ww.j a  v  a2 s  . co m*/
        return getBean("sessionFactory", SessionFactory.class);
    } catch (Exception ex) {
        // Make sure you log the exception, as it might be swallowed
        ex.printStackTrace(System.err);
        throw new ExceptionInInitializerError(ex);
    }
}

From source file:com.github.fge.jsonschema.SchemaVersion.java

SchemaVersion(final String uri, final String resource) {
    try {/*from w ww . j a v  a 2  s . c om*/
        location = URI.create(uri);
        schema = JsonLoader.fromResource(resource);
    } catch (IOException e) {
        throw new ExceptionInInitializerError(e);
    }
}

From source file:org.eclipse.ecr.core.storage.sql.testlib.DatabaseHelper.java

/**
 * Sets the database backend used for VCS unit tests.
 *//*from   ww w . j a  v  a2  s .c  om*/
public static void setDatabaseForTests(String className) {
    try {
        DATABASE = (DatabaseHelper) Class.forName(className).newInstance();
    } catch (Exception e) {
        throw new ExceptionInInitializerError("Database class not found: " + className);
    }
    String msg = "Database used for VCS tests: " + className;
    // System.out used on purpose, don't remove
    System.out.println(DatabaseHelper.class.getSimpleName() + ": " + msg);
    log.info(msg);
}

From source file:org.viafirma.nucleo.custodia.Custodia.java

public static Custodia getInstance() {
    if (singleton == null) {
        throw new ExceptionInInitializerError("El sistema de custodia no esta inicializado.");
    }//from   ww w.  j  av  a  2 s  . com
    return singleton;
}

From source file:org.eclipse.kapua.commons.setting.AbstractKapuaSetting.java

protected AbstractKapuaSetting(String configResourceName) {
    // env+properties configuration
    CompositeConfiguration compositeConfig = new CompositeConfiguration();
    compositeConfig.addConfiguration(new SystemConfiguration());
    try {//from   www. jav  a  2 s  .c  o  m
        URL configLocalUrl = ResourceUtils.getResource(configResourceName);
        compositeConfig.addConfiguration(new PropertiesConfiguration(configLocalUrl));
    } catch (Exception e) {
        s_logger.error("Error loading PropertiesConfiguration", e);
        throw new ExceptionInInitializerError(e);
    }

    this.config = new DataConfiguration(compositeConfig);
}

From source file:org.viafirma.util.QRCodeUtil.java

public static QRCodeUtil getInstance() {
    if (singleton == null) {
        throw new ExceptionInInitializerError("QRCodeUtil no esta inicializado.");
    }//from  www .  jav  a 2s.com
    return singleton;
}

From source file:org.glite.security.voms.admin.persistence.HibernateFactory.java

public static synchronized void initialize(Configuration configuration) {

    Validate.notNull(configuration);/* w  ww  .j  a v a  2 s  .  c  o  m*/

    if (sessionFactory != null) {
        throw new VOMSDatabaseException("Hibernate session factory already initialized!");
    }

    try {

        sessionFactory = configuration.buildSessionFactory();

    } catch (HibernateException e) {

        log.error("Hibernate session factory creation failed!", e);
        throw new ExceptionInInitializerError(e);

    }

}