Monday, August 20, 2012

Enable failover with OpenWebBeans (> 1.1.3)

With Tomcat 7.0.22, some changes has be done when

    ServletRequestListener
           #requestDestroyed(javax.servlet.ServletRequestEvent)

will be called. This caused that session replication was done before OpenWebBeans prepared the beans for the failover.

Therefore a new ServletFilter, which prepares the bean failover before session replication, was added in OpenWebBeans 1.1.4.

Just add it as FIRST filter in your web.xml:

org.apache.webbeans.web.failover.FailOverFilter

and map it for example to the FacesServlet.

Also don't forget the src/main/resources/META-INF/openwebbeans/openwebbeans.properties with following entries:

    configuration.ordinal=100
    org.apache.webbeans.web.failover.issupportfailover=true
    org.apache.webbeans.web.failover.issupportpassivation=true


Update for OWB 1.2.0 -> Click

7 comments:

  1. Interesting, thanks for sharing. Do you know of any good tutorials/blogs on how to do session replication, clustering, load balancing with latest Tomcat or TomEE version?

    ReplyDelete
  2. Just read the tomcat docu about clustering, enable myfaces session serialization and OWB failover.
    You may also configure MyFaces state encryption if you use it, because the keys will be generated on startup otherwise.

    ReplyDelete
  3. Noted. Thanks.

    David Blevins was encouraging me to run 2 copies of the web app on one server and create a L2 cache; I'm assuming/hoping that both copies of the web app are hitting the same database.

    This is something I want to do, ASAP, and I have already started reading/researching this, and that includes the tomcat cluster session replication documentation.

    ReplyDelete
  4. Thanks! This is very helpful.

    You have a typo openwebbans.properties

    Also, how about adding "clustering" for a label (if that even effects search hits)

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete