Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
893 views
in Technique[技术] by (71.8m points)

jsf 2 - JSF how upgrade to Mojarra 2.1.21 in Netbeans7.1 (just sub jsf-api.jar and jsf-impl.jar fails)

I want to upgrade from JSF implementation Mojarra 2.1.3 in Netbeans7.1 (Glassfish 3.1.1).

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.

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:

https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-api/2.1.21/jsf-api-2.1.21.jar https://maven.java.net/content/repositories/releases/com/sun/faces/jsf-impl/2.1.21/jsf-impl-2.1.21.jar

I get the following error:

    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; (&(package=com.sun.faces.spi)(version>=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; (&(package=javax.el)(version>=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)

I tried web app specific JSF but that also fails:

glassfish change default jsf impl

Added to web.xml:

<class-loader delegate="false" />
<property name="useBundledJsf" value="true" />

I get the error:

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.

Grateful for suggestions.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try following steps

  • Download jsf 2.1.21 jar from here
  • Rename it to javax.faces.jar .
  • Take backup of javax.faces.jar available at docrootglassfishmodules
  • Paste and replace the old javax.faces.jar with downloaded javax.faces.jar available at docrootglassfishmodules
  • Delete the osgi cache glassfish3glassfishosgi for the changes to take effect

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...