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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Stephen More
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 ?
Reply | Threaded
Open this post in threaded view
|

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

Aaron Anderson
Are you including a CDI provider like weld in your application and are you using the latest version of Jetty? These versions work for me:

mojarra 2.2.5
weld-servlet 2.1.2.Final
jetty 9.1.1.v20140108
 

On Thursday, February 20, 2014 7:30 AM, Stephen More <[hidden email]> 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 ?


Reply | Threaded
Open this post in threaded view
|

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

Stephen More
No I am not including weld - do I have to ?


On Thu, Feb 20, 2014 at 9:53 AM, Aaron Anderson <[hidden email]> wrote:
Are you including a CDI provider like weld in your application and are you using the latest version of Jetty? These versions work for me:

mojarra 2.2.5
weld-servlet 2.1.2.Final
jetty 9.1.1.v20140108
 

On Thursday, February 20, 2014 7:30 AM, Stephen More <[hidden email]> 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 ?



Reply | Threaded
Open this post in threaded view
|

Re: 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-3
In reply to this post by Stephen More
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 <[hidden email]> 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 <[hidden email]>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

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

Stephen More
The jars can not be removed from the webapp dependecies because those provide the compile time annotation.
The fix was setting the scope of the webapp dependecies to provided.

-Thanks


On Thu, Feb 20, 2014 at 4:54 PM, Jan Bartel <[hidden email]> wrote:
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 <[hidden email]> 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 <[hidden email]>
www.webtide.com
'Expert Jetty/CometD developer,production,operations advice'

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email