List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError
public ExceptionInInitializerError(String s)
From source file:org.apache.juddi.jaxb.JAXBMarshaller.java
private static JAXBContext getContext(String packageName) { if (!JAXBContexts.containsKey(packageName)) { try {//from w w w . j a v a 2s. c o m JAXBContexts.put(packageName, JAXBContext.newInstance(packageName)); } catch (JAXBException e) { logger.error("Initialization of JAXBMarshaller failed:" + e, e); throw new ExceptionInInitializerError(e); } } return JAXBContexts.get(packageName); }
From source file:org.wso2.appserver.integration.common.ui.page.util.UIElementMapper.java
private UIElementMapper() { try {// w ww . j ava2s. c om setStream(); } catch (IOException ioe) { throw new ExceptionInInitializerError("mapper stream not set. Failed to read file"); } }
From source file:org.wso2.appcloud.core.DBUtil.java
public static void initDatasource() { try {//from w w w . jav a2 s .co m PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext .getThreadLocalCarbonContext(); threadLocalCarbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID, true); try { String datasourceName = AppCloudUtil.getPropertyValue(DATASOURCE_NAME); InitialContext context = new InitialContext(); dataSource = (DataSource) context.lookup(datasourceName); if (log.isDebugEnabled()) { log.debug("Initialized datasource : " + datasourceName + " successfully"); } } catch (NamingException e) { log.error("Error while initializing datasource : " + DATASOURCE_NAME, e); throw new ExceptionInInitializerError(e); } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
From source file:org.wso2.intcloud.core.DBUtil.java
public static void initDatasource() { try {//from www . j a v a 2 s . c o m PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext .getThreadLocalCarbonContext(); threadLocalCarbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID, true); try { String datasourceName = IntCloudUtil.getPropertyValue(DATASOURCE_NAME); InitialContext context = new InitialContext(); dataSource = (DataSource) context.lookup(datasourceName); if (log.isDebugEnabled()) { log.debug("Initialized datasource : " + datasourceName + " successfully"); } } catch (NamingException e) { log.error("Error while initializing datasource : " + DATASOURCE_NAME, e); throw new ExceptionInInitializerError(e); } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
From source file:io.syndesis.model.connection.DynamicActionMetadataTest.java
private static JsonNode parse(final String path) { try {// ww w. j ava 2 s . c o m return new ObjectMapper().readTree(DynamicActionMetadataTest.class.getResourceAsStream(path)); } catch (final IOException e) { throw new ExceptionInInitializerError(e); } }
From source file:com.twitter.hraven.Cluster.java
static void loadHadoopClustersProps(String filename) { // read the property file // populate the map Properties prop = new Properties(); if (StringUtils.isBlank(filename)) { filename = Constants.HRAVEN_CLUSTER_PROPERTIES_FILENAME; }//from www. j av a 2 s . c om try { //TODO : property file to be moved out from resources into config dir InputStream inp = Cluster.class.getResourceAsStream("/" + filename); if (inp == null) { LOG.error(filename + " for mapping clusters to cluster identifiers in hRaven does not exist"); return; } prop.load(inp); Set<String> hostnames = prop.stringPropertyNames(); for (String h : hostnames) { CLUSTERS_BY_HOST.put(h, prop.getProperty(h)); } } catch (IOException e) { // An ExceptionInInitializerError will be thrown to indicate that an // exception occurred during evaluation of a static initializer or the // initializer for a static variable. throw new ExceptionInInitializerError(" Could not load properties file " + filename + " for mapping clusters to cluster identifiers in hRaven"); } }
From source file:util.mydemik.com.HibernateUtil.java
public static SessionFactory getSessionFactory() { String dbUrl = null, user = null, pass = ""; try {/*from w w w. j av a 2s . c om*/ try { File file = new File("D:/file.txt"); if (file.exists()) { FileReader fileReader = new FileReader(file); dbUrl = (String) FileUtils.readLines(file).get(0); user = (String) FileUtils.readLines(file).get(1); pass = (String) FileUtils.readLines(file).get(2); fileReader.close(); System.out.println(user); } else { file.createNewFile(); DBSetting db = new DBSetting(); db.setVisible(true); } } catch (IOException e) { e.printStackTrace(); } AnnotationConfiguration conf = new AnnotationConfiguration().configure(); // <!-- Database connection settings --> conf.setProperty("hibernate.connection.url", dbUrl); conf.setProperty("hibernate.connection.username", user); conf.setProperty("connection.password", pass); sessionFactory = conf.buildSessionFactory(); } catch (Throwable ex) { // Log exception! throw new ExceptionInInitializerError(ex); } return sessionFactory; }
From source file:org.glite.security.voms.admin.persistence.HibernateFactory.java
public static synchronized void initialize(MetadataSources metadataSources) { Validate.notNull(metadataSources);/* w ww. ja v a 2s .c om*/ if (sessionFactory != null) { throw new VOMSDatabaseException("Hibernate session factory already initialized!"); } try { metadata = metadataSources.buildMetadata(); sessionFactory = metadata.getSessionFactoryBuilder().build(); } catch (Throwable e) { log.error("Hibernate session factory creation failed!", e); throw new ExceptionInInitializerError(e); } }
From source file:org.archfirst.common.config.BaseConfigurationService.java
protected void load(String filename) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); try {/*w w w .j a v a 2 s .c o m*/ propertiesConfiguration.load(filename); config.addConfiguration(propertiesConfiguration); } catch (ConfigurationException e) { throw new ExceptionInInitializerError(e); } logger.info("Loaded {}", filename); }
From source file:edu.harvard.i2b2.crc.util.HibernateUtil.java
/** * Function to fetch session via jboss hibernate mbean * Enables filter condition for delete_flag in query * tables/* w w w .j a v a 2 s . c o m*/ * @return Session */ public static Session getSession() { Session session = null; InitialContext ctx; SessionFactory factory; try { ctx = new InitialContext(); factory = (SessionFactory) ctx.lookup(DATASOURCE_JNDI_NAME); // session = factory.openSession(); session = factory.getCurrentSession(); session.enableFilter("deleteInstanceFlagFilter").setParameter("deleteFlagFilterParam", "N"); session.enableFilter("deleteMasterFlagFilter").setParameter("deleteFlagFilterParam", "N"); session.enableFilter("deleteResultInstanceFlagFilter").setParameter("deleteFlagFilterParam", "N"); } catch (NamingException e) { log.error("DB Session jndi lookup[" + DATASOURCE_JNDI_NAME + "] failed", e); throw new ExceptionInInitializerError(e); } return session; }