You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marc Limotte <ms...@gmail.com> on 2011/11/10 17:32:06 UTC

ContextInitialization fails, but app starts anyway

Hi.

For reference, my set up is Tomcat 5.5.27, Java 1.6.0_22 , Ubuntu 10.04.3.

Once in a while when starting Tomcat; ContextInitialization fails for
my app (specifically, Spring DI fails), but the app still comes up in
a broken state.  Is there a way to make this a hard fail-- Ideally
tomcat wouldn't start at all and would exit with a non-zero exit code?

I'm separately investigating why Initialization fails, but at this
time I'm looking for an easier way for our automated tools to know
immediately that there is a problem (regardless of what the problem
is).

thanks,
Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ContextInitialization fails, but app starts anyway

Posted by Daniel Mikusa <dm...@vmware.com>.
Marc,

Yep, think you're right.  My fault for not paying closer attention to
your version.

Other options that come to mind...

- fetch one of the URL's for your application, check for a 404 status

- connect via JMX, look at "Catalina:type=Deployer,host=localhost"
(substitute your host name for localhost).  That object exposes a
"isDeploy" operation which will show a true / false value indicating if
the app is deployed.

Dan


On Thu, 2011-11-10 at 08:57 -0800, Marc Limotte wrote:
> Thanks for the suggestion, Dan.
> 
> Sound like that option would be perfect, but I do not see it for
> Tomcat 5.5 (https://tomcat.apache.org/tomcat-5.5-doc/config/systemprops.html).
>  Is there a work-around or alternative for users of older Tomcat
> versions?
> 
> Marc
> 
> On Thu, Nov 10, 2011 at 11:43 AM, Daniel Mikusa <dm...@vmware.com> wrote:
> > Marc,
> >
> > Take a look at "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE".
> >
> > >From the docs...
> >
> > "If true, the server will exit if an exception happens during the server
> > initialization phase. If not specified, the default value of false will
> > be used."
> >
> > https://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
> >
> > Dan
> >
> >
> > On Thu, 2011-11-10 at 08:32 -0800, Marc Limotte wrote:
> >> Hi.
> >>
> >> For reference, my set up is Tomcat 5.5.27, Java 1.6.0_22 , Ubuntu 10.04.3.
> >>
> >> Once in a while when starting Tomcat; ContextInitialization fails for
> >> my app (specifically, Spring DI fails), but the app still comes up in
> >> a broken state.  Is there a way to make this a hard fail-- Ideally
> >> tomcat wouldn't start at all and would exit with a non-zero exit code?
> >>
> >> I'm separately investigating why Initialization fails, but at this
> >> time I'm looking for an easier way for our automated tools to know
> >> immediately that there is a problem (regardless of what the problem
> >> is).
> >>
> >> thanks,
> >> Marc
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Re: ContextInitialization fails, but app starts anyway

Posted by Marc Limotte <ms...@gmail.com>.
Thanks for the suggestion, Dan.

Sound like that option would be perfect, but I do not see it for
Tomcat 5.5 (https://tomcat.apache.org/tomcat-5.5-doc/config/systemprops.html).
 Is there a work-around or alternative for users of older Tomcat
versions?

Marc

On Thu, Nov 10, 2011 at 11:43 AM, Daniel Mikusa <dm...@vmware.com> wrote:
> Marc,
>
> Take a look at "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE".
>
> >From the docs...
>
> "If true, the server will exit if an exception happens during the server
> initialization phase. If not specified, the default value of false will
> be used."
>
> https://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
>
> Dan
>
>
> On Thu, 2011-11-10 at 08:32 -0800, Marc Limotte wrote:
>> Hi.
>>
>> For reference, my set up is Tomcat 5.5.27, Java 1.6.0_22 , Ubuntu 10.04.3.
>>
>> Once in a while when starting Tomcat; ContextInitialization fails for
>> my app (specifically, Spring DI fails), but the app still comes up in
>> a broken state.  Is there a way to make this a hard fail-- Ideally
>> tomcat wouldn't start at all and would exit with a non-zero exit code?
>>
>> I'm separately investigating why Initialization fails, but at this
>> time I'm looking for an easier way for our automated tools to know
>> immediately that there is a problem (regardless of what the problem
>> is).
>>
>> thanks,
>> Marc
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: ContextInitialization fails, but app starts anyway

Posted by Daniel Mikusa <dm...@vmware.com>.
Marc,

Take a look at "org.apache.catalina.startup.EXIT_ON_INIT_FAILURE".

>From the docs...

"If true, the server will exit if an exception happens during the server
initialization phase. If not specified, the default value of false will
be used."

https://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html

Dan


On Thu, 2011-11-10 at 08:32 -0800, Marc Limotte wrote:
> Hi.
> 
> For reference, my set up is Tomcat 5.5.27, Java 1.6.0_22 , Ubuntu 10.04.3.
> 
> Once in a while when starting Tomcat; ContextInitialization fails for
> my app (specifically, Spring DI fails), but the app still comes up in
> a broken state.  Is there a way to make this a hard fail-- Ideally
> tomcat wouldn't start at all and would exit with a non-zero exit code?
> 
> I'm separately investigating why Initialization fails, but at this
> time I'm looking for an easier way for our automated tools to know
> immediately that there is a problem (regardless of what the problem
> is).
> 
> thanks,
> Marc
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>