问题
I'm trying add richfaces to my JSF 2 project using this jboss guide. I've did what they say in point 2.6, but after restart my tomcat server, HTTP Status 404 is reported.
Have I missed something??
UPDATE: When I add richfaces-components-ui-4.0.0.Final.jar and richfaces-core-impl-4.0.0.Final.jar, and restart the tomcat server, it reports:
INFO: Unsanitized stacktrace from failed start...
com.sun.faces.config.ConfigurationException:
Source Document: jar:file:/D:/WORKSPACE/BC/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PORTAL/WEB-INF/lib/richfaces-core-impl-4.0.0.Final.jar!/META-INF/faces-config.xml
Cause: Unable to create a new instance of 'org.richfaces.resource.ResourceHandlerImpl': java.lang.reflect.InvocationTargetException
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:293)
....
13.5.2011 8:41:52 com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! com.google.common.base.Function
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:379)
....
13.5.2011 8:41:52 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! com.google.common.base.Function
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
....
13.5.2011 8:41:52 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
13.5.2011 8:41:52 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/PORTAL] startup failed due to previous errors
13.5.2011 8:41:52 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:894)
....
And now I'm not sure which libraries are neccessary for JSF2 and which for RICHFACES..
回答1:
According to readme.txt
of RichFaces 4 the following JARs are required:
In addition to the RichFaces jars, a number of dependencies are required in order to properly configure the framework.
a.
sac-1.3
,cssparser-0.9.5
- required for components CSS work.b.
google-guava-r08
- core runtime dependency.c.
annotations.jar
- from org.richfaces.cdk.
- It's optional and only needs to be added if RichFaces components will be created/accessed dynamically in your apps actions/listeners.
d.
validation-api.jar
and any implementation like hibernate-validators.jar
- It's optional and should be added if you using Client or Graph Validation. Should be added only if it's not provided by a server (Java EE 6 servers).
Your exception suggests that you don't have the Google Guava library.
来源:https://stackoverflow.com/questions/5987933/adding-richfaces-to-existing-jsf2-project