Re: [jetty-user] JSF 2.2 helloWorld + mvn jetty:run = CONFIGURATION FAILED! com.sun.faces.vendor.WebContainerInjectionProvider cannot be cast to com.sun.faces.spi.InjectionProvider

Jan Bartel <[email protected]> Fri, 21 Feb 2014 08:54:14 +1100
Newsgroups gmane.comp.java.jetty.support
Message-ID <CALg=VpjmZnD+hbgnc_Ywy5GobwKv-7df0SzpWpP-eMtJU=pFCA@mail.gmail.com>
Stephen,

Your configuration includes the jsf jars twice - once as dependencies
of the webapp and then again as dependencies of the jetty maven
plugin. This means the classes are loaded by both the webapp
classloader and the container classloader, leading to conflicts.

Remove the api and impl jars from the webapp dependecies as they
should only be container dependencies.

Also see the section on using JSF with jetty here:
http://www.eclipse.org/jetty/documentation/current/configuring-jsp.html#jsp-support

Jan

On 21 February 2014 00:28, Stephen More <[email protected]> wrote:
> I have an extremely simple web app that works fine with mojarra 2.1.26. (
> https://code.google.com/p/maven-examples/source/browse/#svn%2Ftrunk%2Fjsf-22
> )
> But when I try to upgrade it to 2.2.5 it throws this exception:
>
> Caused by:
> java.lang.ClassCastException:
> com.sun.faces.vendor.WebContainerInjectionProvider cannot be cast to
> com.sun.faces.spi.InjectionProvider
>         at
> javax.faces.FactoryFinder$FactoryManager.copyInjectionProviderFromFacesContext(FactoryFinder.java:1051)
>         at
> javax.faces.FactoryFinder$FactoryManager.<init>(FactoryFinder.java:1035)
>         at
> javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:856)
>         at
> javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryManager(FactoryFinder.java:793)
>         at
> javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder.java:768)
>         at javax.faces.FactoryFinder.setFactory(FactoryFinder.java:409)
>         at
> com.sun.faces.config.processor.FactoryConfigProcessor.setFactory(FactoryConfigProcessor.java:317)
>         at
> com.sun.faces.config.processor.FactoryConfigProcessor.processFactories(FactoryConfigProcessor.java:259)
>         at
> com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:216)
>         at
> com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
>         at
> com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:214)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:801)
>         at
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:446)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:793)
>         at
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:296)
>
> Is this a bug or a issue with my configuration ?



-- 
Jan Bartel <[email protected]>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'