Tomcat 9 could not find ServletContextListener with @WebListener annotation after proguard.
@WebListener
public class MyListener implements ServletContextListener {
}
It works before proguard.
After proguard, the class name is changed to "a".
@WebListener
public class a implements ServletContextListener {
}
From java decompiler, the @WebListener annotation is kept in the obfuscated class. Tomcat 9 did not call the listener and no error messages.
After adding the listener in web.xml, did not help.
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<listener>
<listener-class>com.example.a</listener-class>
</listener>
</web-app>
the listener was ignored and no error messages.