use of org.apache.catalina.LifecycleException in project Payara by payara.
the class FileLogger method start.
// ------------------------------------------------------ Lifecycle Methods
/**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
public void start() throws LifecycleException {
// Validate and update our current component state
if (started)
throw new LifecycleException(rb.getString(LogFacade.FILE_LOGGER_STARTED));
lifecycle.fireLifecycleEvent(START_EVENT, null);
started = true;
super.start();
}
use of org.apache.catalina.LifecycleException in project tomcat-cluster-redis-session-manager by ran-jit.
the class SessionManager method startInternal.
/**
* {@inheritDoc}
*/
@Override
protected synchronized void startInternal() throws LifecycleException {
super.startInternal();
super.setState(LifecycleState.STARTING);
boolean initializedValve = false;
Context context = getContextIns();
for (Valve valve : context.getPipeline().getValves()) {
if (valve instanceof SessionHandlerValve) {
this.handlerValve = (SessionHandlerValve) valve;
this.handlerValve.setSessionManager(this);
initializedValve = true;
break;
}
}
if (!initializedValve)
throw new LifecycleException("Session handling valve is not initialized..");
initialize();
log.info("The sessions will expire after " + (getSessionTimeout(null)) + " seconds.");
context.setDistributable(true);
}
use of org.apache.catalina.LifecycleException in project Payara by payara.
the class SetParentClassLoaderRule method load.
/**
* Start a new server instance.
*/
public void load() {
initDirs();
// Before digester - it may be needed
initNaming();
// Create and execute our Digester
Digester digester = createStartDigester();
long t1 = System.currentTimeMillis();
Exception ex = null;
InputSource inputSource = null;
InputStream inputStream = null;
File file = null;
try {
file = configFile();
inputStream = new FileInputStream(file);
inputSource = new InputSource("file://" + file.getAbsolutePath());
} catch (Exception e) {
;
}
if (inputStream == null) {
try {
inputStream = getClass().getClassLoader().getResourceAsStream(getConfigFile());
inputSource = new InputSource(getClass().getClassLoader().getResource(getConfigFile()).toString());
} catch (Exception e) {
;
}
}
// Alternative: don't bother with xml, just create it manually.
if (inputStream == null) {
try {
inputStream = getClass().getClassLoader().getResourceAsStream("server-embed.xml");
inputSource = new InputSource(getClass().getClassLoader().getResource("server-embed.xml").toString());
} catch (Exception e) {
;
}
}
if (inputStream == null && file != null) {
String msg = MessageFormat.format(rb.getString(LogFacade.CANNOT_LOAD_SERVER_XML_EXCEPTION), file.getAbsolutePath());
log.log(Level.WARNING, msg);
return;
}
if (inputStream != null) {
try {
inputSource.setByteStream(inputStream);
digester.push(this);
digester.parse(inputSource);
} catch (Exception e) {
log.log(Level.WARNING, LogFacade.CATALINA_START_WARNING_EXCEPTION, e);
return;
} finally {
try {
inputStream.close();
} catch (IOException ioe) {
}
}
}
// Start the new server
if (server instanceof Lifecycle) {
try {
server.initialize();
} catch (LifecycleException e) {
log.log(Level.SEVERE, LogFacade.CATALINA_START_SEVERE_EXCEPTION, e);
}
}
if (log.isLoggable(Level.INFO)) {
long t2 = System.currentTimeMillis();
String msg = MessageFormat.format(rb.getString(LogFacade.INIT_PROCESSED_EXCEPTION), (t2 - t1));
log.log(Level.INFO, msg);
}
}
Aggregations