java.lang.ClassNotFoundException : com.sun.faces.config.ConfigureListener

流过昼夜 提交于 2019-11-26 22:51:02
BalusC

JSF is usually bundled in full fledged Java EE application servers such as GlassFish, JBoss AS/EAP, WildFly, WebSphere, WebLogic, etc. However, Tomcat is a barebones JSP/Servlet container which bundles only the JSP and Servlet APIs, no JSF API.

If you want to use JSF on Tomcat, then you'd need to bundle the JSF libraries along with the webapp in its /WEB-INF/lib folder, or to install JSF in Tomcat by placing the JSF libraries in its /lib folder. Apparently that application is designed for real Java EE applications servers and hence doesn't bundle the JSF libraries in /WEB-INF/lib.

There are two JSF implementations available, Mojarra and MyFaces. The com.sun.faces package indicates Mojarra, so download that one and put it in webapp's runtime classpath (i.e. either in webapp's /WEB-INF/lib or in Tomcat's /lib).


Another possible cause is that you deployed the project to a Java EE application server which uses MyFaces instead of Mojarra, while the project was apparently initially developed for Mojarra. That listener is namely Mojarra specific. In such case, you'd better remove the entire <listener> entry from web.xml.

In any case, the explicit registration of Mojarra's ConfigureListener in web.xml is actually only necessary to workaround old buggy servers such as GlassFish v3 and Jetty who failed to find the listener in Mojarra's TLD file. When deployed to a decent server, the whole <listener> entry is unnecessary.

See also:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!