use of net.jforum.exceptions.ForumStartupException in project jforum2 by rafaelsteil.
the class JForumBaseServlet method startApplication.
protected void startApplication() {
try {
SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_GENERIC));
SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_DRIVER));
String filename = SystemGlobals.getValue(ConfigKeys.QUARTZ_CONFIG);
SystemGlobals.loadAdditionalDefaults(filename);
ConfigLoader.createLoginAuthenticator();
ConfigLoader.loadDaoImplementation();
ConfigLoader.listenForChanges();
ConfigLoader.startSearchIndexer();
ConfigLoader.startSummaryJob();
} catch (Exception e) {
throw new ForumStartupException("Error while starting JForum", e);
}
}
use of net.jforum.exceptions.ForumStartupException in project jforum2 by rafaelsteil.
the class JForum method init.
/**
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
super.startApplication();
// Start database
isDatabaseUp = ForumStartup.startDatabase();
try {
Connection conn = DBConnection.getImplementation().getConnection();
conn.setAutoCommit(!SystemGlobals.getBoolValue(ConfigKeys.DATABASE_USE_TRANSACTIONS));
// Try to fix some MySQL problems
MySQLVersionWorkarounder dw = new MySQLVersionWorkarounder();
dw.handleWorkarounds(conn);
// Continues loading the forum
JForumExecutionContext ex = JForumExecutionContext.get();
ex.setConnection(conn);
JForumExecutionContext.set(ex);
// Init general forum stuff
ForumStartup.startForumRepository();
RankingRepository.loadRanks();
SmiliesRepository.loadSmilies();
BanlistRepository.loadBanlist();
} catch (Throwable e) {
e.printStackTrace();
throw new ForumStartupException("Error while starting jforum", e);
} finally {
JForumExecutionContext.finish();
}
}
use of net.jforum.exceptions.ForumStartupException in project jforum2 by rafaelsteil.
the class JForumBaseServlet method init.
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
String appPath = config.getServletContext().getRealPath("");
debug = "true".equals(config.getInitParameter("development"));
DOMConfigurator.configure(appPath + "/WEB-INF/log4j.xml");
logger.info("Starting JForum. Debug mode is " + debug);
ConfigLoader.startSystemglobals(appPath);
ConfigLoader.startCacheEngine();
// Configure the template engine
Configuration templateCfg = new Configuration();
templateCfg.setTemplateUpdateDelay(2);
templateCfg.setSetting("number_format", "#");
templateCfg.setSharedVariable("startupTime", new Long(new Date().getTime()));
// Create the default template loader
String defaultPath = SystemGlobals.getApplicationPath() + "/templates";
FileTemplateLoader defaultLoader = new FileTemplateLoader(new File(defaultPath));
String extraTemplatePath = SystemGlobals.getValue(ConfigKeys.FREEMARKER_EXTRA_TEMPLATE_PATH);
if (StringUtils.isNotBlank(extraTemplatePath)) {
// An extra template path is configured, we need a MultiTemplateLoader
FileTemplateLoader extraLoader = new FileTemplateLoader(new File(extraTemplatePath));
TemplateLoader[] loaders = new TemplateLoader[] { extraLoader, defaultLoader };
MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders);
templateCfg.setTemplateLoader(multiLoader);
} else {
// An extra template path is not configured, we only need the default loader
templateCfg.setTemplateLoader(defaultLoader);
}
ModulesRepository.init(SystemGlobals.getValue(ConfigKeys.CONFIG_DIR));
this.loadConfigStuff();
if (!this.debug) {
templateCfg.setTemplateUpdateDelay(3600);
}
JForumExecutionContext.setTemplateConfig(templateCfg);
} catch (Exception e) {
throw new ForumStartupException("Error while starting JForum", e);
}
}
Aggregations