You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jeremy Boynes <jb...@apache.org> on 2006/04/04 20:19:24 UTC
Re: svn commit: r391292 - /incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
We should not be writing things to stdout/stderr - we should be logging
to Tomcat and let it direct the messages where appropriate.
We should also not rewrap unchecked Exceptions in RuntimeException. I
would hope Tomcat logged unchecked Exceptions from listeners; if it
isn't we should log them to its log rather than stderr before rethrowing
(with a comment that this is to work around its failure to log).
--
Jeremy
rineholt@apache.org wrote:
> Author: rineholt
> Date: Tue Apr 4 05:51:48 2006
> New Revision: 391292
>
> URL: http://svn.apache.org/viewcvs?rev=391292&view=rev
> Log:
> We need to report configuration errors to the user.
> Currently without this change the webapp is not initialized but no errors are given to the end user.
> Logging is not sufficient for a error like this.
>
>
> Modified:
> incubator/tuscany/java/sca/tomcat/src/main/java/org/apache/tuscany/tomcat/TuscanyContextListener.java
>
> 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=391292&r1=391291&r2=391292&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 05:51:48 2006
> @@ -81,28 +81,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) {
> }
> return;
> + }catch( Exception e){
> + e.printStackTrace();
> + e.printStackTrace(System.out);
> + new RuntimeException(e);
> +
> }
> - 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);
> }
>
> private void loadContext(Context ctx) throws ConfigurationException {
>
>