title: JSF how upgrade to Mojarra 2.1.21 in Netbeans7.1 (just sub jsf-api.jar and jsf-impl.jar fails)
body: <p>I want to upgrade from JSF implementation Mojarra 2.1.3 in Netbeans7.1 (Glassfish 3.1.1).</p>
  
  <p>You might ask first why I don't just upgrade to Netbeans7.3, and the reasons include that it  it runs Glassfish 3.1.2.2 and that I have some other 3rd party software in my web application that is not yet compatible with Glassfish higher than 3.1.1, and besides it only has Mojarra 2.1.6 anyway.</p>
  
  <p>I used to be able to upgrade Mojarra by simply replacing jsf-api.jar and jsf-impl.jar under /glassfish/modules, but that does not work with:</p>
  
  <p><a href="https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-api/2.1.21/jsf-api-2.1.21.jar" rel="nofollow noreferrer">https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-api/2.1.21/jsf-api-2.1.21.jar</a>
  <a href="https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-impl/2.1.21/jsf-impl-2.1.21.jar" rel="nofollow noreferrer">https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-impl/2.1.21/jsf-impl-2.1.21.jar</a></p>
  
  <p>I get the following error:</p>
  
  <pre><code>    SEVERE: java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97)
  at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:55)
  Caused by: com.sun.enterprise.module.ResolveError: Failed to start Bundle Id [301] State [INSTALLED] [org.glassfish.web.weld-integration(Weld integration for glassfish):3.1.1]
  at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.start(OSGiModuleImpl.java:177)
  at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$2$1$1.loadClass(OSGiModuleImpl.java:344)
  at com.sun.hk2.component.LazyInhabitant.loadClass(LazyInhabitant.java:124)
  at com.sun.hk2.component.LazyInhabitant.fetch(LazyInhabitant.java:111)
  at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:135)
  at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
  at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:701)
  at java.util.AbstractList$Itr.next(AbstractList.java:345)
  at java.util.AbstractCollection.toArray(AbstractCollection.java:124)
  at java.util.ArrayList.addAll(ArrayList.java:472)
  at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffers(SnifferManagerImpl.java:92)
  at com.sun.enterprise.v3.server.SnifferManagerImpl.getSniffer(SnifferManagerImpl.java:120)
  at com.sun.enterprise.v3.server.ApplicationLifecycle.getSniffersFromApp(ApplicationLifecycle.java:2140)
  at com.sun.enterprise.v3.server.ApplicationLoaderService.processApplication(ApplicationLoaderService.java:375)
  at com.sun.enterprise.v3.server.ApplicationLoaderService.postConstruct(ApplicationLoaderService.java:219)
  at com.sun.hk2.component.AbstractCreatorImpl.inject(AbstractCreatorImpl.java:131)
  at com.sun.hk2.component.ConstructorCreator.initialize(ConstructorCreator.java:91)
  at com.sun.hk2.component.AbstractCreatorImpl.get(AbstractCreatorImpl.java:82)
  at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
  at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:139)
  at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:76)
  at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:253)
  at com.sun.enterprise.v3.server.AppServerStartup.doStart(AppServerStartup.java:145)
  at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:136)
  at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
  at com.sun.enterprise.glassfish.bootstrap.GlassFishDecorator.start(GlassFishDecorator.java:63)
  at com.sun.enterprise.glassfish.bootstrap.osgi.OSGiGlassFishImpl.start(OSGiGlassFishImpl.java:69)
  at com.sun.enterprise.glassfish.bootstrap.GlassFishMain$Launcher.launch(GlassFishMain.java:117)
  ... 6 more
  Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle org.glassfish.web.weld-integration [301]: Unable to resolve 301.0: missing requirement [301.0] package; (&amp;(package=com.sun.faces.spi)(version&gt;=2.1.0)) [caused by: Unable to resolve 213.1: missing requirement [213.1] package; (package=javax.faces) [caused by: Unable to resolve 211.1: missing requirement [211.1] package; (&amp;(package=javax.el)(version&gt;=2.2.1))]]
  at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3443)
  at org.apache.felix.framework.Felix.startBundle(Felix.java:1727)
  at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:922)
  at org.jvnet.hk2.osgiadapter.OSGiModuleImpl.start(OSGiModuleImpl.java:169)
  </code></pre>
  
  <p>I tried web app specific JSF but that also fails:</p>
  
  <p><a href="https://stackoverflow.com/questions/14849553/glassfish-change-default-jsf-impl">glassfish change default jsf impl</a></p>
  
  <p>Added to web.xml:</p>
  
  <pre><code>&lt;class-loader delegate="false" /&gt;
  &lt;property name="useBundledJsf" value="true" /&gt;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Error occurred during deployment: Exception while loading the app :    
  java.lang.IllegalStateException: ContainerBase.addChild: start:  
  org.apache.catalina.LifecycleException: java.lang.RuntimeException: 
  com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! 
  org.glassfish.weld.jsf.WeldFacesConfigProvider cannot be cast to 
  com.sun.faces.spi.ConfigurationResourceProvider. Please see server.log for more details.
  </code></pre>
  
  <p>Grateful for suggestions.</p>