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

Stephen More <[email protected]> Thu, 20 Feb 2014 19:24:24 -0500
Newsgroups gmane.comp.java.jetty.support
Message-ID <CAL2vA_MK_psGeOoqAeoz8TVnV+sQqwsQxWav-=GFwgGqCrJZJg@mail.gmail.com>
--089e013a12f8e217bb04f2dfa491
Content-Type: text/plain; charset=ISO-8859-1

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 <[email protected]> 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 <[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'
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

--089e013a12f8e217bb04f2dfa491
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>The jars can not be removed from the webapp depe=
ndecies because those provide the compile time annotation.<br></div>The fix=
 was setting the scope of the webapp dependecies to provided.<br><br></div>
-Thanks<br></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quo=
te">On Thu, Feb 20, 2014 at 4:54 PM, Jan Bartel <span dir=3D"ltr">&lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;</=
span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Stephen,<br>
<br>
Your configuration includes the jsf jars twice - once as dependencies<br>
of the webapp and then again as dependencies of the jetty maven<br>
plugin. This means the classes are loaded by both the webapp<br>
classloader and the container classloader, leading to conflicts.<br>
<br>
Remove the api and impl jars from the webapp dependecies as they<br>
should only be container dependencies.<br>
<br>
Also see the section on using JSF with jetty here:<br>
<a href=3D"http://www.eclipse.org/jetty/documentation/current/configuring-j=
sp.html#jsp-support" target=3D"_blank">http://www.eclipse.org/jetty/documen=
tation/current/configuring-jsp.html#jsp-support</a><br>
<br>
Jan<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
On 21 February 2014 00:28, Stephen More &lt;<a href=3D"mailto:stephen.more@=
gmail.com">[email protected]</a>&gt; wrote:<br>
&gt; I have an extremely simple web app that works fine with mojarra 2.1.26=
. (<br>
&gt; <a href=3D"https://code.google.com/p/maven-examples/source/browse/#svn=
%2Ftrunk%2Fjsf-22" target=3D"_blank">https://code.google.com/p/maven-exampl=
es/source/browse/#svn%2Ftrunk%2Fjsf-22</a><br>
&gt; )<br>
&gt; But when I try to upgrade it to 2.2.5 it throws this exception:<br>
&gt;<br>
&gt; Caused by:<br>
&gt; java.lang.ClassCastException:<br>
&gt; com.sun.faces.vendor.WebContainerInjectionProvider cannot be cast to<b=
r>
&gt; com.sun.faces.spi.InjectionProvider<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; javax.faces.FactoryFinder$FactoryManager.copyInjectionProviderFromFace=
sContext(FactoryFinder.java:1051)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; javax.faces.FactoryFinder$FactoryManager.&lt;init&gt;(FactoryFinder.ja=
va:1035)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryMan=
ager(FactoryFinder.java:856)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; javax.faces.FactoryFinder$FactoryManagerCache.getApplicationFactoryMan=
ager(FactoryFinder.java:793)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; javax.faces.FactoryFinder$FactoryManagerCache.access$100(FactoryFinder=
.java:768)<br>
&gt; =A0 =A0 =A0 =A0 at javax.faces.FactoryFinder.setFactory(FactoryFinder.=
java:409)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; com.sun.faces.config.processor.FactoryConfigProcessor.setFactory(Facto=
ryConfigProcessor.java:317)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; com.sun.faces.config.processor.FactoryConfigProcessor.processFactories=
(FactoryConfigProcessor.java:259)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryC=
onfigProcessor.java:216)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)<=
br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureLis=
tener.java:214)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized=
(ContextHandler.java:801)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized=
(ServletContextHandler.java:446)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHa=
ndler.java:793)<br>
&gt; =A0 =A0 =A0 =A0 at<br>
&gt; org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletCo=
ntextHandler.java:296)<br>
&gt;<br>
&gt; Is this a bug or a issue with my configuration ?<br>
<br>
<br>
<br>
</div></div><span class=3D"HOEnZb"><font color=3D"#888888">--<br>
Jan Bartel &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt;=
<br>
<a href=3D"http://www.webtide.com" target=3D"_blank">www.webtide.com</a><br=
>
&#39;Expert Jetty/CometD developer,production,operations advice&#39;<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe from this list, please visit:<br>
<br>
=A0 =A0 <a href=3D"http://xircles.codehaus.org/manage_email" target=3D"_bla=
nk">http://xircles.codehaus.org/manage_email</a><br>
<br>
<br>
</font></span></blockquote></div><br></div>

--089e013a12f8e217bb04f2dfa491--