tomcat - How to prevent JSF from initializing automatically? -


when create web application scratch , add jsf-api-2.2.11.jar , jsf-impl-2.2.11.jar pom.xml (add them apps classpath) , deploy tomcat 7, jsf initializing automatically:

info [j.e.r.w.j.config] - mojarra 2.2.11 ( 20150505-0732 https://svn.java.net/svn/mojarra~svn/tags/2.2.11@14688) ..... initialized. 

in older versions used start declarativly defining in web.xml (listener+servlet). commented them out , set "metadata-complete" "true" (does stop classpath scanning?), still loading.

in case dont want load, while leaving jars in classpath , i.e. faces-config.xml in web-inf.

what still triggering initialization?

it's loaded via servlet 3.0 servletcontainerinitializer implementation in jsf implementation jar file (in case of mojarra, it's com.sun.faces.config.facesinitializer). auto-register facesservlet on url patterns *.jsf, *.faces , /faces/* (jsf 2.3 add *.xhtml list of url patterns). latest jsf 2.1 implementations , jsf 2.2 implementations when deployed servlet 3.0 compatible container. detail new servlet 3.0 servletcontainerinitializer thing, head answer: servletcontainerinitializer vs servletcontextlistener.

the right way stop removing jsf implementation dependencies (note not need remove jsf api well). seem not making use of in way. after all, designed web application should not have jsf implementation specific dependencies. wonder, why leave jsf api in? using 3rd party jsf based library non-jsf purposes? might indicate , end in other (architectural) problems.

another way of stopping downgrading web application servlet 2.5 targeted editing <web-app> root declaration in web.xml accordingly comply version. has many other side effects may not desireable when intent develop servlet 3.0 compatible web application.


the "listener" you're referring not necessary, it's workaround buggy containers timing errors in parsing tld files, such glassfish v3 , jetty versions. see a.o. configuration of com.sun.faces.config.configurelistener.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -