You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Giovanni <pi...@yahoo.com> on 2010/01/07 11:15:48 UTC

How to close a Wicket application?

I am using Spring + Wicket.

When the Wicket application starts, if some important configuration is missing, I want to close all the application context, destroying all the Spring beans, including also the Wicket application, which is configured as a Spring bean by SpringWebApplicationFactory.

I used the close() (I also tried stop() and destroy() methods) of the ApplicationContext, but it doesn't destroy the Wicket app.

I then searched for a method of Wicket Application, which allows to stop/close the webapp, but I did not find it.

How is it possible to stop a Wicket application from inside the application itself (that is suicide)?

Best regards,
giovanni



      

Re: How to close a Wicket application?

Posted by Giovanni <pi...@yahoo.com>.
We have some configurations (e.g. URL for webservices), which are coming from properties defined in the launch command of the application server (e.g -Dws.url=...).

We do in this way, instead of using properties file, because the client (bank) environment for deploying is very rigid and unconvenient even for redeploying a war. That's why we decided to keep some properties outside of the war file.

The client environment is very unstable, where many errors happens during the deployment. So we think that defining some properties using the command line can give us some more flexibility.

Anyway we found some compromised solution using the ApplicationContext.close() method. It's not perfect, but we can live with that.

best regards
giovanni




________________________________
From: Juan Carlos Garcia M. <jc...@gmail.com>
To: users@wicket.apache.org
Sent: Thu, January 7, 2010 7:25:58 PM
Subject: Re: How to close a Wicket application?


@Giovanni,

Maybe you should re-think that requirement. 

Even thought your intentions are good, if you review carefully your
statement "if some important configuration is missing", what could be
missing if you deploy your application as a self contained war? You mean
like DataSources or Container specific configuration?

If that happens to you then you should need to review your deployment
strategy. Or if you can explain more what are you trying to achieve or
explain what problem is you actually having, we could find you an alternate
solution.



Giovanni-40 wrote:
> 
> Hi Martjin,
> 
> I tried with System.exit(1) on Weblogic, but it is also stopping the whole
> Weblogic server. It seems that this solution is too strong. :)
> 
> Maybe the solution ofMartin Grigorov is softer.
> 
> At the end, we are using the ApplicationContext.close() method, which
> seems to stop the Spring beans, except the Wicket bean (I don't understand
> why). Then, if a user tries to call a Wicket page, he will get an error,
> not because the Wicket app is down, but because the collaborating Spring
> beans are down.
> 
> regards,
> giovanni
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Martijn Dashorst <ma...@gmail.com>
> To: users@wicket.apache.org
> Sent: Thu, January 7, 2010 12:13:53 PM
> Subject: Re: How to close a Wicket application?
> 
> Call System.exit(1) ... that will do the trick.
> 
> Always nice to see all applications deployed to a container disappear.
> 
> Martijn
> 
> On Thu, Jan 7, 2010 at 12:03 PM, Erik van Oosten <e....@grons.nl>
> wrote:
>> There is no hook in Wicket to stop. Wicket normally starts and ends with
>> the
>> web context it is running in. So ending the application is done by
>> undeploying the web-app. You'll need to find hooks in your serlvet
>> container. Spring will automatically shutdown with the web context as
>> well.
>>
>> Regards,
>>   Erik.
>>
>> Giovanni wrote:
>>>
>>> I am using Spring + Wicket.
>>>
>>> When the Wicket application starts, if some important configuration is
>>> missing, I want to close all the application context, destroying all the
>>> Spring beans, including also the Wicket application, which is configured
>>> as
>>> a Spring bean by SpringWebApplicationFactory.
>>>
>>> I used the close() (I also tried stop() and destroy() methods) of the
>>> ApplicationContext, but it doesn't destroy the Wicket app.
>>>
>>> I then searched for a method of Wicket Application, which allows to
>>> stop/close the webapp, but I did not find it.
>>>
>>> How is it possible to stop a Wicket application from inside the
>>> application itself (that is suicide)?
>>>
>>> Best regards,
>>> giovanni
>>>
>>
>> --
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
>      
> 

-- 
View this message in context: http://old.nabble.com/How-to-close-a-Wicket-application--tp27057651p27064635.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


      

Re: How to close a Wicket application?

Posted by "Juan Carlos Garcia M." <jc...@gmail.com>.
@Giovanni,

Maybe you should re-think that requirement. 

Even thought your intentions are good, if you review carefully your
statement "if some important configuration is missing", what could be
missing if you deploy your application as a self contained war? You mean
like DataSources or Container specific configuration?

If that happens to you then you should need to review your deployment
strategy. Or if you can explain more what are you trying to achieve or
explain what problem is you actually having, we could find you an alternate
solution.



Giovanni-40 wrote:
> 
> Hi Martjin,
> 
> I tried with System.exit(1) on Weblogic, but it is also stopping the whole
> Weblogic server. It seems that this solution is too strong. :)
> 
> Maybe the solution ofMartin Grigorov is softer.
> 
> At the end, we are using the ApplicationContext.close() method, which
> seems to stop the Spring beans, except the Wicket bean (I don't understand
> why). Then, if a user tries to call a Wicket page, he will get an error,
> not because the Wicket app is down, but because the collaborating Spring
> beans are down.
> 
> regards,
> giovanni
> 
> 
> 
> 
> 
> 
> ________________________________
> From: Martijn Dashorst <ma...@gmail.com>
> To: users@wicket.apache.org
> Sent: Thu, January 7, 2010 12:13:53 PM
> Subject: Re: How to close a Wicket application?
> 
> Call System.exit(1) ... that will do the trick.
> 
> Always nice to see all applications deployed to a container disappear.
> 
> Martijn
> 
> On Thu, Jan 7, 2010 at 12:03 PM, Erik van Oosten <e....@grons.nl>
> wrote:
>> There is no hook in Wicket to stop. Wicket normally starts and ends with
>> the
>> web context it is running in. So ending the application is done by
>> undeploying the web-app. You'll need to find hooks in your serlvet
>> container. Spring will automatically shutdown with the web context as
>> well.
>>
>> Regards,
>>   Erik.
>>
>> Giovanni wrote:
>>>
>>> I am using Spring + Wicket.
>>>
>>> When the Wicket application starts, if some important configuration is
>>> missing, I want to close all the application context, destroying all the
>>> Spring beans, including also the Wicket application, which is configured
>>> as
>>> a Spring bean by SpringWebApplicationFactory.
>>>
>>> I used the close() (I also tried stop() and destroy() methods) of the
>>> ApplicationContext, but it doesn't destroy the Wicket app.
>>>
>>> I then searched for a method of Wicket Application, which allows to
>>> stop/close the webapp, but I did not find it.
>>>
>>> How is it possible to stop a Wicket application from inside the
>>> application itself (that is suicide)?
>>>
>>> Best regards,
>>> giovanni
>>>
>>
>> --
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
>       
> 

-- 
View this message in context: http://old.nabble.com/How-to-close-a-Wicket-application--tp27057651p27064635.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: How to close a Wicket application?

Posted by Giovanni <pi...@yahoo.com>.
Hi Martjin,

I tried with System.exit(1) on Weblogic, but it is also stopping the whole Weblogic server. It seems that this solution is too strong. :)

Maybe the solution ofMartin Grigorov is softer.

At the end, we are using the ApplicationContext.close() method, which seems to stop the Spring beans, except the Wicket bean (I don't understand why). Then, if a user tries to call a Wicket page, he will get an error, not because the Wicket app is down, but because the collaborating Spring beans are down.

regards,
giovanni






________________________________
From: Martijn Dashorst <ma...@gmail.com>
To: users@wicket.apache.org
Sent: Thu, January 7, 2010 12:13:53 PM
Subject: Re: How to close a Wicket application?

Call System.exit(1) ... that will do the trick.

Always nice to see all applications deployed to a container disappear.

Martijn

On Thu, Jan 7, 2010 at 12:03 PM, Erik van Oosten <e....@grons.nl> wrote:
> There is no hook in Wicket to stop. Wicket normally starts and ends with the
> web context it is running in. So ending the application is done by
> undeploying the web-app. You'll need to find hooks in your serlvet
> container. Spring will automatically shutdown with the web context as well.
>
> Regards,
>   Erik.
>
> Giovanni wrote:
>>
>> I am using Spring + Wicket.
>>
>> When the Wicket application starts, if some important configuration is
>> missing, I want to close all the application context, destroying all the
>> Spring beans, including also the Wicket application, which is configured as
>> a Spring bean by SpringWebApplicationFactory.
>>
>> I used the close() (I also tried stop() and destroy() methods) of the
>> ApplicationContext, but it doesn't destroy the Wicket app.
>>
>> I then searched for a method of Wicket Application, which allows to
>> stop/close the webapp, but I did not find it.
>>
>> How is it possible to stop a Wicket application from inside the
>> application itself (that is suicide)?
>>
>> Best regards,
>> giovanni
>>
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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


      

Re: How to close a Wicket application?

Posted by Martijn Dashorst <ma...@gmail.com>.
Call System.exit(1) ... that will do the trick.

Always nice to see all applications deployed to a container disappear.

Martijn

On Thu, Jan 7, 2010 at 12:03 PM, Erik van Oosten <e....@grons.nl> wrote:
> There is no hook in Wicket to stop. Wicket normally starts and ends with the
> web context it is running in. So ending the application is done by
> undeploying the web-app. You'll need to find hooks in your serlvet
> container. Spring will automatically shutdown with the web context as well.
>
> Regards,
>   Erik.
>
> Giovanni wrote:
>>
>> I am using Spring + Wicket.
>>
>> When the Wicket application starts, if some important configuration is
>> missing, I want to close all the application context, destroying all the
>> Spring beans, including also the Wicket application, which is configured as
>> a Spring bean by SpringWebApplicationFactory.
>>
>> I used the close() (I also tried stop() and destroy() methods) of the
>> ApplicationContext, but it doesn't destroy the Wicket app.
>>
>> I then searched for a method of Wicket Application, which allows to
>> stop/close the webapp, but I did not find it.
>>
>> How is it possible to stop a Wicket application from inside the
>> application itself (that is suicide)?
>>
>> Best regards,
>> giovanni
>>
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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


Re: How to close a Wicket application?

Posted by Erik van Oosten <e....@grons.nl>.
There is no hook in Wicket to stop. Wicket normally starts and ends with 
the web context it is running in. So ending the application is done by 
undeploying the web-app. You'll need to find hooks in your serlvet 
container. Spring will automatically shutdown with the web context as well.

Regards,
    Erik.

Giovanni wrote:
> I am using Spring + Wicket.
>
> When the Wicket application starts, if some important configuration is missing, I want to close all the application context, destroying all the Spring beans, including also the Wicket application, which is configured as a Spring bean by SpringWebApplicationFactory.
>
> I used the close() (I also tried stop() and destroy() methods) of the ApplicationContext, but it doesn't destroy the Wicket app.
>
> I then searched for a method of Wicket Application, which allows to stop/close the webapp, but I did not find it.
>
> How is it possible to stop a Wicket application from inside the application itself (that is suicide)?
>
> Best regards,
> giovanni
>       
>   

-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



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


Re: How to close a Wicket application?

Posted by Martin Grigorov <mc...@e-card.bg>.
On Thu, 2010-01-07 at 02:15 -0800, Giovanni wrote:
> I am using Spring + Wicket.
> 
> When the Wicket application starts, if some important configuration is missing, I want to close all the application context, destroying all the Spring beans, including also the Wicket application, which is configured as a Spring bean by SpringWebApplicationFactory.
> 
> I used the close() (I also tried stop() and destroy() methods) of the ApplicationContext, but it doesn't destroy the Wicket app.
> 
> I then searched for a method of Wicket Application, which allows to stop/close the webapp, but I did not find it.
> 
> How is it possible to stop a Wicket application from inside the application itself (that is suicide)?
One option is to use the underlying JMX capabilities of the application
server and request stop/undeploy of the application. 
Another option is to set a flag (application scope) and modify the
RequestCycle to always redirect to some "Sorry, the application doesn't
work" page if that flag is set to true.
> 
> Best regards,
> giovanni
> 
> 
> 
>       



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