Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 634843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:20:23+00:00 2026-05-13T20:20:23+00:00

I have a Wicket Web Application running in Tomcat. The application uses Spring (via

  • 0

I have a Wicket Web Application running in Tomcat. The application uses Spring (via org.springframework.web.context.ContextLoaderListener) to initialise the application. This is all well and good for start up, but what I would also like is to receive some sort of notification that the Context is being destroyed so that I can shutdown spawned threads. Is there a way of receiving such a notification? I’ve included excerpts from my application to aid your understanding of my question.

web.xml extract

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:com/mysite/web/spring/applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

Spring applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
    "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans>
    <bean id="MyWebService" class="com.mysite.web.MyWebApp">
    </bean>
</beans>

MyWebApp.java extract

public class MyWebApp extends org.apache.wicket.protocol.http.WebApplication {
    private MyWebServiceServiceAPI webservice =
       MyWebServiceAppImpl.getMyWebService();

    public MyWebServiceWebApp() {
    }

    @Override
    public void init() {
        super.init();
        webservice.start();
    }
}

MyWebServiceAppImpl.java extract

    public class MyWebServiceAppImpl  extends ServiceImpl
        implements MyWebServiceServiceAPI  {
        // The ServiceImpl implements the Callable<T> interface

    private static MyWebServiceServiceAPI instance;
    private List<Future<ServiceImpl>> results =
        new ArrayList<Future<ServiceImpl>>();
    private ExecutorService pool = Executors.newCachedThreadPool();


    private MyWebServiceAppImpl() {
        super(.....);
    }

    public synchronized static MyWebServiceServiceAPI getMyWebService() {
        if (instance == null) {
            instance = new MyWebServiceAppImpl();
            instance.start();
        }
        return instance;
    }

@Override
public synchronized void start() {

    if (!started()) {
        pool.submit(this);
        super.start();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:20:23+00:00Added an answer on May 13, 2026 at 8:20 pm

    Yes, you can implement your own ContextListener.

    package myapp;
    
    public class MyContextListener implements ServletContextListener {
    
    
    
        public void contextInitialized(ServletContextEvent arg0) {
            //called when context is started
        }
    
    
        public void contextDestroyed(ServletContextEvent arg0) {
          //called context destroyed
        }   
    }
    

    You need to add that listener to your web.xml

     <listener>
        <listener-class>myapp.MyContextListener</listener-class>
     </listener>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a new web application that uses Linux, Apache, Tomcat, Wicket, JPA/Hibernate, and
I have this web application that i have created using Wicket, Guice and JPA.
I'm working on a web application with Wicket, Spring and Hibernate and I've come
Have a n-tire web application and search often times out after 30 secs. How
I'm new to Wicket and would like to maintain a web application from inside
I've got a web application that's running really slowly and occasionally hanging. It's a
I am new to Wicket framework, I have seen many good reviews on this
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have developed web applications using JSF (myfaces components). But in these days of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.