WildFly not loading @WebListener class on startup

164 views
Skip to first unread message

Lucas Guimarães Bernardes (skypartan)

unread,
Dec 28, 2022, 3:40:02 PM12/28/22
to WildFly
Hello,

I'm currently trying to migrate a Java EE application from Payara platform to WildFly. Our application is running on Java EE 8 and as such we are trying to use WildFly 26.1.2.Final as our current target version. The problem I've found is that the exact same war used to deploy the application into payara fails to start on wildfly. We have a ServletContextListener class annotated with @WebListener that loads the required system configurations on startup, mainly database and cache connection details, however it never runs on wildfly, only payara. There are no "metadata-complete" definitions on the web.xml, and manually specifying a <listener> tag also doesn't work.

The listener class definition is essentially the following, there are no funky custom logic, just a simple "contextInitialized".
@WebListener
public class ServletListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
         carregarConfiguracoes(); // load config file
         inicializarCache(); // initialize cache
    }
}

Any help is very much appreciated.

frank.l...@outlook.de

unread,
Dec 30, 2022, 6:10:40 AM12/30/22
to WildFly
We're using the same since many years over many releases of JBoss AS / Wildfly.

How ist your application packaged and deployed ?
war file standalone or a war file inside an ear archive ?
Did you include a web-app.xml file here ?

Reply all
Reply to author
Forward
0 new messages