List of usage examples for java.lang ExceptionInInitializerError ExceptionInInitializerError
public ExceptionInInitializerError(String s)
From source file:net.fenyo.gnetwatch.Synchro.java
/** * Constructor.//from ww w . j ava 2 s. c o m * Reads the configuration properties from the initialization file. * main thread * @param config configuration. */ public Synchro(final Config config) { this.config = config; new Configuration().configure(new File("hibernate.cfg.xml")); try { // Cration de la SessionFactory partir de hibernate.cfg.xml sessionFactory = new Configuration().configure(new File("hibernate.cfg.xml")).buildSessionFactory(); } catch (Throwable ex) { // make sure we log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } }
From source file:org.apache.ambari.server.security.encryption.CredentialProviderTest.java
private void createMasterKey(String dir) { File f = new File( dir + System.getProperty("file" + ".separator") + Configuration.MASTER_KEY_FILENAME_DEFAULT); if (!f.exists()) { try {/*from w w w . j a v a2 s .c o m*/ f.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } MasterKeyService ms = new MasterKeyServiceImpl("blahblah!", f.getAbsolutePath(), true); if (!ms.isMasterKeyInitialized()) { throw new ExceptionInInitializerError("Cannot create master key."); } }
From source file:com.excilys.ebi.spring.dbunit.servlet.DataLoaderListener.java
@Override public void contextInitialized(ServletContextEvent sce) { context = getWebApplicationContext(sce.getServletContext()); try {// w w w . j a v a 2 s. c o m configuration = configurationProcessor.getConfiguration(context); dataLoader.execute(context, configuration, Phase.SETUP); } catch (Exception e) { LOGGER.error("Error while initializing DbUnit data", e); throw new ExceptionInInitializerError(e); } }
From source file:org.string_db.psicquic.AppProperties.java
/** * Read all property files and fill in the fields * * @throws ExceptionInInitializerError//from w w w . java 2 s .c o m */ private AppProperties() throws ExceptionInInitializerError { Properties props = new Properties(); try { final FileInputStream inStream = new FileInputStream(CONFIG_DIR + "psicquic.properties"); props.load(inStream); inStream.close(); } catch (Exception e) { throw new ExceptionInInitializerError("can't load properties: " + e.getMessage()); } if (!props.containsKey("solr_url")) { throw new ExceptionInInitializerError("solr_url property missing!"); } solrUrl = props.getProperty("solr_url"); logger.info("solr at: " + solrUrl); ctx = new AnnotationConfigApplicationContext(AppConfig.class, DriverDataSourceConfig.class); }
From source file:com.idega.hibernate.HibernateUtil.java
private static SessionFactory configure(String cfgPath) { try {/*from www . j a v a 2 s . c o m*/ Configuration configuration = new AnnotationConfiguration(); if (cfgPath == null) configuration.configure(); else configuration.configure(cfgPath); return configuration.buildSessionFactory(); } catch (Throwable ex) { Logger.getLogger(HibernateUtil.class.getName()).log(Level.SEVERE, "Initial SessionFactory creation failed for cfg path: " + cfgPath, ex); throw new ExceptionInInitializerError(ex); } }
From source file:com.mgmtp.jfunk.unit.UnitSupport.java
public static UnitSupport getInstance() { if (instance == null) { synchronized (UnitSupport.class) { if (instance == null) { try { String propsFileName = System.getProperty("jfunk.props.file", "jfunk.properties"); Module module = ModulesLoader.loadModulesFromProperties(new UnitModule(), propsFileName); Injector injector = Guice.createInjector(module); instance = injector.getInstance(UnitSupport.class); instance.eventBus.post(new BeforeRunEvent()); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { instance.eventBus.post(new AfterRunEvent()); }//from w w w. jav a 2 s . co m }); } catch (Exception ex) { LOGGER.error("Error initializing Guice", ex); throw new ExceptionInInitializerError(ex); } } } } return instance; }
From source file:lu.list.itis.dkd.aig.SimilarityProvider.java
/** * Constructor initialising the comparator from properties read from a properties file. * * @throws ExceptionInInitializerError//from ww w .ja va 2s .c o m */ private SimilarityProvider() throws ExceptionInInitializerError { final Properties properties = PropertiesFetcher.getProperties(); if (properties.isEmpty()) { throw new ExceptionInInitializerError("The properties file could not be located!"); //$NON-NLS-1$ } useSemanticSimilarity = Boolean.parseBoolean( properties.getProperty(Externalization.SEMANTIC_SIMILARITY_PROPERTY, Externalization.FALSE_STRING)); useStringSimilarity = Boolean.parseBoolean( properties.getProperty(Externalization.STRING_SIMILARITY_PROPERTY, Externalization.FALSE_STRING)); useSoundexSimilarity = Boolean.parseBoolean( properties.getProperty(Externalization.SOUNDEX_SIMILARITY_PROPERTY, Externalization.FALSE_STRING)); semanticSimilarityWeight = Float.parseFloat(properties .getProperty(Externalization.SEMANTIC_SIMILARITY_WEIGHT_PROPERTY, Externalization.ZERO_INTEGER)); stringSimilarityWeight = Float.parseFloat(properties .getProperty(Externalization.STRING_SIMILARITY_WEIGHT_PROPERTY, Externalization.ZERO_INTEGER)); soundexSimilarityWeight = Float.parseFloat(properties .getProperty(Externalization.SOUNDEX_SIMILARITY_WEIGHT_PROPERTY, Externalization.ZERO_INTEGER)); if (useSemanticSimilarity) { throw new NotImplementedException("semantic similarity not yet available"); //instantiateSemanticSimilarityBridge(); } }
From source file:com.example.administrator.datarequest.ningworld.NoHttp.java
/** * Get application of app./*from w ww .j a va 2 s . com*/ * * @return {@link Application}. */ public static Application getContext() { if (sApplication == null) throw new ExceptionInInitializerError( "Please invoke NoHttp.init(Application) on Application#onCreate()"); return sApplication; }
From source file:com.mockey.ui.JsonSchemaLoadSamplesServlet.java
public void init() throws ServletException { try {/* ww w . j ava2s . c o m*/ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(SAMPLESJSON); if (is == null) { is = getClass().getClassLoader().getResourceAsStream(SAMPLESJSON); } String myString = IOUtils.toString(is, "UTF-8"); final JsonNode node = JsonLoader.fromString(myString); SAMPLE_DATA = ImmutableList.copyOf(node); SAMPLE_DATA_SIZE = SAMPLE_DATA.size(); } catch (IOException e) { System.err.println(e); throw new ExceptionInInitializerError(e); } }
From source file:org.fao.geonet.arcgis.ArcSDEApiConnection.java
/** * Opens a connection to the specified ArcSDE server. */// www . j a va 2 s .c om public ArcSDEApiConnection(String server, int instance, String database, String username, String password) { try { seConnection = new SeConnection(server, instance, database, username, password); Log.info(ARCSDE_LOG_MODULE_NAME, "Connected to ArcSDE using the Java API"); seConnection.setConcurrency(SeConnection.SE_LOCK_POLICY); } catch (SeException x) { SeError error = x.getSeError(); String description = error.getExtError() + " " + error.getExtErrMsg() + " " + error.getErrDesc(); Log.error(ARCSDE_LOG_MODULE_NAME, "Error connecting to ArcSDE (via API): " + description, x); throw new ExceptionInInitializerError(x); } }