Author: jboynes
Date: Tue Apr 4 15:47:29 2006
New Revision: 391434
URL: http://svn.apache.org/viewcvs?rev=391434&view=rev
Log:
error logging for Tomcat listener
Modified:
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
incubator/tuscany/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties
Modified:
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java?rev=391434&r1=391433&r2=391434&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
(original)
+++
incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
Tue Apr 4 15:47:29 2006
@@ -36,6 +36,7 @@
import org.apache.tuscany.core.config.ModuleComponentConfigurationLoader;
import org.apache.tuscany.core.context.AggregateContext;
import org.apache.tuscany.core.context.EventContext;
+import org.apache.tuscany.core.context.EventException;
import org.apache.tuscany.core.runtime.RuntimeContext;
import org.apache.tuscany.model.assembly.AssemblyFactory;
import org.apache.tuscany.model.assembly.AssemblyModelContext;
@@ -81,37 +82,37 @@
try {
loadContext(ctx);
- moduleContext.fireEvent(EventContext.MODULE_START, null);
-
- // add a valve to this context's pipeline that will associate the
request with the runtime
- Valve valve = new TuscanyValve(moduleContext);
- ctx.getPipeline().addValve(valve);
-
- // add the web service servlet wrapper
- addWebServiceWrapper(ctx);
- addJSONRPCServiceWrapper(ctx);
-
- // add the RuntimeContext in as a servlet context parameter
- ServletContext servletContext = ctx.getServletContext();
- servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime);
- servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext);
-
-
} catch (ConfigurationException e) {
- e.printStackTrace();
- e.printStackTrace(System.out);
log.error("context.configError", e);
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e1) {
- }
+ // todo mark application as unavailable
return;
- }catch( Exception e){
- e.printStackTrace();
- e.printStackTrace(System.out);
- new RuntimeException(e);
-
}
+
+ try {
+ moduleContext.fireEvent(EventContext.MODULE_START, null);
+ } catch (EventException e) {
+ log.error("context.moduleStartError", e);
+ // todo unload module component from runtime
+ // todo mark application as unavailable
+ return;
+ } catch (RuntimeException e) {
+ log.error("context.unknownRuntimeException", e);
+ // todo unload module component from runtime
+ throw e;
+ }
+
+ // add a valve to this context's pipeline that will associate the
request with the runtime
+ Valve valve = new TuscanyValve(moduleContext);
+ ctx.getPipeline().addValve(valve);
+
+ // add the web service servlet wrapper
+ addWebServiceWrapper(ctx);
+ addJSONRPCServiceWrapper(ctx);
+
+ // add the RuntimeContext in as a servlet context parameter
+ ServletContext servletContext = ctx.getServletContext();
+ servletContext.setAttribute(TUSCANY_RUNTIME_NAME, runtime);
+ servletContext.setAttribute(MODULE_COMPONENT_NAME, moduleContext);
}
private void loadContext(Context ctx) throws ConfigurationException {
@@ -130,7 +131,6 @@
AggregateContext rootContext = runtime.getRootContext();
rootContext.registerModelObject(moduleComponent);
moduleContext =
(AggregateContext)rootContext.getContext(moduleComponent.getName());
-
//moduleContext.registerModelObject(moduleComponent.getComponentImplementation());
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
Modified:
incubator/tuscany/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties?rev=391434&r1=391433&r2=391434&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties
(original)
+++
incubator/tuscany/java/sca/tomcat/src/main/resources/org/apache/tuscany/tomcat/LocalStrings.properties
Tue Apr 4 15:47:29 2006
@@ -20,3 +20,5 @@
tuscanyHost.notContext = Child of a TuscanyHost must be a StandardContext
context.configError = Error loading the SCA configuration
+context.moduleStartError = Error starting SCA module
+context.unknownRuntimeException = Unexpected RuntimeException