List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError
public ExceptionInInitializerError(String s)
From source file:com.qa.onlinebanking.dao.ObjectDao.java
public static void makeSessionFactory() { try {// w ww . j a v a2 s . c o m factory = new Configuration().configure().buildSessionFactory(); } catch (HibernateException ex) { throw new ExceptionInInitializerError(ex); } }
From source file:gov.nih.nci.cadsrapi.dao.orm.CleanerDAO.java
private static void setFactory() { try {//from ww w . ja v a2 s. co m // Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed ex.printStackTrace(); log.error("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } }
From source file:org.apache.juddi.config.PersistenceManager.java
public static EntityManager getEntityManager() { try {//from ww w . j av a 2 s . c o m if (emf == null) AppConfig.getInstance(); } catch (ConfigurationException e) { log.error("Error initializing config in PersistenceManager", e); throw new ExceptionInInitializerError(e); } return emf.createEntityManager(); }
From source file:net.nineapps.hystqio.util.HibernateUtil.java
private static SessionFactory buildSessionFactory() { try {//from w w w.j a v a 2s. c o m // Create the SessionFactory from hibernate.cfg.xml return new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed log.error("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } }
From source file:edu.harvard.i2b2.crc.util.HibernateUtil.java
/** * Function to fetch hibernate session// ww w. j a v a 2s. c o m * outside of app server * USE INSIDE TEST CLASSES ONLY TO RUN TEST OUTSIDE APPSERVER */ public static SessionFactory getSessionFactory() { SessionFactory sessionFactory = null; try { // Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { log.error("Error creating session factory", ex); // Make sure you log the exception, as it might be swallowed throw new ExceptionInInitializerError(ex); } return sessionFactory; }
From source file:edu.sjsu.cmpe275.lab2.repository.HibernateUtil.java
@Bean public static SessionFactory getSessionFactory() { if (sessionFactory == null) { //initialize one factory try {/*from ww w.j a v a 2 s .co m*/ Configuration configuration = new Configuration().configure(); ServiceRegistry serviceRegistry = new ServiceRegistryBuilder() .applySettings(configuration.getProperties()).buildServiceRegistry(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); } catch (Throwable e) { throw new ExceptionInInitializerError(e); } } return sessionFactory; }
From source file:edu.sjsu.cmpe275.lab2.model.HibernateUtil.java
@Bean public static SessionFactory getSessionFactory() { if (sessionFactory == null) { //initialize one factory try {// w w w. j ava 2 s. c o m Configuration configuration = new Configuration().configure(); // StandardServiceRegistryBuilder builder= new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()); // ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry(); //sessionFactory = configuration.buildSessionFactory( builder.build()); sessionFactory = configuration.buildSessionFactory(); } catch (Throwable e) { throw new ExceptionInInitializerError(e); } } return sessionFactory; }
From source file:org.viafirma.cliente.openid.OpenIdHandlerFactory.java
/** * Crea una nueva instancia del Manejador OpenId utilizando los parametros indicados * @param propiedades/*from www. j a v a2s . com*/ * @return */ public static OpenIdHandler build(Properties propiedades) { try { // recuperamos la url de retorno de autenticacin String urlAplicacion = propiedades.getProperty(Constantes.PARAM_URL_APLICACION); if (urlAplicacion == null) { log.fatal("El cliente OpenId No ha podido ser inicializado, Falta el parametro " + Constantes.PARAM_URL_APLICACION); throw new ExceptionInInitializerError( "El cliente OpenId No ha podido ser inicializado, Falta el parametro " + Constantes.PARAM_URL_APLICACION); } else { log.debug("Nuevo cliente OpenID con url de retorno para la autenticacin OpenId:" + urlAplicacion); // inicializo la instancia return new OpenIdHandler(urlAplicacion); } // asigno la instancia generada como instancia singleton. } catch (ConsumerException e) { log.fatal("El cliente OpenId No ha podido ser inicializado.", e); throw new ExceptionInInitializerError( "El cliente OpenId No ha podido ser inicializado." + e.getMessage()); } }
From source file:org.wso2.am.integration.ui.tests.util.UIElementMapper.java
/** * Provides the UI element access value configured in /mapper.properties * * @param key UI element key configured in /mapper.properties * @return String : Access value of the Ui element * @throws java.io.IOException//from w w w . j a v a2 s . c o m */ public static String getElement(String key) throws IOException { String uiELemetValue = null; if (uiProperties == null) { uiProperties = new Properties(); InputStream inputStream = UIElementMapper.class.getResourceAsStream("/mapper.properties"); try { if (inputStream.available() > 0) { uiProperties.load(inputStream); } } catch (IOException ioE) { log.error(ioE); throw new ExceptionInInitializerError("Mapper stream not set. Failed to read file"); } finally { try { inputStream.close(); } catch (Exception ioE) { log.error(ioE); throw new ExceptionInInitializerError( "Mapper stream not closed correctly. Failed to close the stream"); } } } uiELemetValue = uiProperties.getProperty(key); return uiELemetValue; }
From source file:org.apache.juddi.config.PersistenceManager.java
protected static void initializeEntityManagerFactory(String persistenceUnitName) { try {//w ww.ja v a 2 s. c o m if (emf == null) { Properties properties = new Properties(); properties.put("openjpa.ConnectionURL", System.getProperty("uddi.openjpa.ConnectionURL")); emf = Persistence.createEntityManagerFactory(persistenceUnitName, properties); } } catch (Throwable t) { log.error("entityManagerFactory creation failed", t); throw new ExceptionInInitializerError(t); } }