I am getting the below exception after migrating to JSF 2.2. Specifically, I\'m upgrading Mojarra 2.1.17 to Mojarra 2.2.8.
java.lang.NoSuchMethodError: javax
That method was introduced in JSF 2.2. This problem will thus happen when the webapp's runtime classpath is polluted with multiple different versioned JSF API libraries. In other words, you've still a JSF 2.0 or 2.1 API somewhere in the runtime classpath.
This suggests that you're trying to upgrade JSF by manually bundling it in the webapp and deploying it to a Java EE container which already bundles JSF out the box, such as WildFly, JBoss AS, GlassFish, WebLogic, WebSphere, etc. Your stacktrace is too short in order to be able to confirm that, but your question history confirms that you're using WebLogic.
In order to properly upgrade Mojarra in WebLogic, you should actually be replacing the JSF JAR(s) in /wlserver/modules
folder.
In case you're actually using a barebones servletcontainer which doesn't bundle JSF out the box, such as Tomcat, then you'd need to verify if /WEB-INF/lib
(or pom file in case of Maven) is free of duplicates in JSF API. Most common starter's mistake is having a javaee-api.jar
in there too. This should be removed (or be set to provided
). See also a.o. How do I import the javax.servlet API in my Eclipse project?