Topic
  • 2 replies
  • Latest Post - ‏2013-08-26T02:14:47Z by Kun Peng Fan
Kun Peng Fan
Kun Peng Fan
2 Posts

Pinned topic why Liberty can't auto-start ServletContextListener

‏2013-08-23T06:32:03Z |

I have a ServletContextListener class and register it in web.xml as a listener.

After deployed to Liberty, I found the class is not loaded when web app starting, until I clicked home page of the web app.

 

  • Iain_Duncan
    Iain_Duncan
    23 Posts

    Re: why Liberty can't auto-start ServletContextListener

    ‏2013-08-23T06:54:37Z  

    By default the server lazy initializes the web application upon first request, so ServletContextListeners are not called until something accesses the web app.

    You can turn off that behavior by adding this setting to your server.xml:

    
    <webContainer deferServletLoad="false"/>
    
  • Kun Peng Fan
    Kun Peng Fan
    2 Posts

    Re: why Liberty can't auto-start ServletContextListener

    ‏2013-08-26T02:14:47Z  

    By default the server lazy initializes the web application upon first request, so ServletContextListeners are not called until something accesses the web app.

    You can turn off that behavior by adding this setting to your server.xml:

    <pre class="pre codeblock" dir="ltr" style="font-family: 'Courier New', Courier, monospace; font-size: 13px; background-color: rgb(218, 218, 218); padding: 5px; white-space: pre-wrap; word-wrap: break-word; color: rgb(0, 0, 0);"> <webContainer deferServletLoad="false"/> </pre>

    It works! thanks a lot. It is a happy starting of this week.