0 Replies Latest reply on Feb 18, 2014 8:51 AM by Nicolas Barrera

    Wildfly “Lazy-Inits” Filters, can I change that?

    Nicolas Barrera Newbie

      I think I 've found a difference in the implementation of Filter initialization between Jetty and Wildfly.

       

      I 've a web application using Tapestry, Spring and Hibernate. I 'm trying to migrate it from Jetty to Wildfly.

       

      My web.xml has two filters:

       

      Firstly the OpenSessionInViewFilter (which requires the WebApplicationContext to exist when doInternalFilter is executed). This filter needs to be before Tapestry's so that the hibernate session embraces all Tapestry activity against the backend database.

       

      Second to that is the Tapestry framework (w/ spring integration) Filter which in it's init method loads the spring's WebApplicationContext.

       

      I was running this scenario without a problem in Jetty (also in Tomcat), but when moving it to Wildfly the OpenSessionInViewFilter threw an IllegalStateException telling that no WebApplicationContext was found.

       

      I tried debugging this and found out that Wildfly is not calling the init Filter method until that Filter receives the first request to process. I agree this could be a performance improvement in certain scenarios but it's a problem in my current scenario.

      Is there any way to tell Wildfly to init filters on the application startup?

       

      thank you.