RichFaces 5 on Tomcat 7: could not find factory - jsf-2

This question is similar to:
java.lang.IllegalStateException:Could not find backup for factory javax.faces.application.ApplicationFactory
But unfortunately it is not my case. I have richfaces-5.0.0.Alpha1.jar inside my WAR and jboss-jsf-api_2.1_spec-2.0.2.Final.jar in the Tomcat lib folder. Nothing else. I don't use MyFaces and never did.
The log is the following:
Grave: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory. Attempting to find backup.
dic 12, 2013 1:41:41 PM org.apache.catalina.core.ApplicationContext log
Grave: StandardWrapper.Throwable
java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1008)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

"jboss-jsf-api_2.1_spec-2.0.2.Final.jar" why that one and not the proper JSF jar you can download from javaserverfaces.java.net? I think you have only the API and no JSF implementation here.
(Don't know how to convert a comment into an answer, so I just reposted).

Related

Spring Boot - java.lang.ClassNotFoundException: javax.servlet.ServletContext and Unable to start EmbeddedWebApplicationContext

I have a Spring Boot application (Grails 3.1.8), but when I run the application in IntelliJ IDEA I get the following error:
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163)
at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:292)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:510)
... 26 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152)
... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 33 common frames omitted
I tried adding javax-servlet-api dependency as suggested in an answer to Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext
But then I started getting:
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at grails.boot.GrailsApp.run(GrailsApp.groovy:55)
at grails.boot.GrailsApp.run(GrailsApp.groovy:374)
at grails.boot.GrailsApp.run(GrailsApp.groovy:363)
at grails.boot.GrailsApp$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
at closemytab.Application.main(Application.groovy:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:185)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 18 common frames omitted
This post then suggests to remove the javax-servlet-api: Spring boot -- Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
But then I face the original issue.
Any thoughts?
The issue was with the build.gradle file:
provided "org.springframework.boot:spring-boot-starter-tomcat"
IntelliJ IDEA wasn't happy with the provided.
As soon as I switched to
compile "org.springframework.boot:spring-boot-starter-tomcat"
the application worked.
Run with a Maven Spring Boot goal:
spring-boot:run
Steps to set up Maven configuration in IntelliJ IDEA:
Menu Debug/Run Configuration → Click on the + button visible at the top left → Select Maven → Set command line to spring-boot:run.
If you are using IntelliJ IDEA, you need to enable ' Include dependencies with "Provider" scope in menu Run → Edit Configurations → Application → 'your main class' (by default it's disabled)
Adding the dependency below fixed my issue:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Remember to have a parent dependency as well!
For me, it's because of the Tomcat version. I changed Tomcat version from 7.5 to 8.5, and the problem's solved.
Exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext only means you are not providing the Tomcat dependency to your application. In case you are using IntelliJ IDEA, it’s really simple to do that as shown below.
Select your project → open the Maven panel (it mostly resides on the top right side of the panel) → select embedded.

Target Unreachable, identifier 'navigationBean' resolved to null [duplicate]

I am developing an application for FB Login with website using Javascript and JSF. I have posted my code at here. The problem is, when I run my application it does't show the JSF page, it instead throws the following exception:
Nov 28, 2013 7:21:46 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/FacebookLogin] threw exception [javax/servlet/jsp/jstl/core/Config] with root cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:344)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:153)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
What is the problem here and how can I solve it?
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
As the package name hints, the mentioned class is part of JSTL. The exception is clearly telling that the class definition file of the mentioned class cannot be found in the runtime classpath. I.e. the Config.class file or at least the JAR file containing that class is missing in webapp's runtime classpath.
JSTL is normally already provided out the box by a full fledged Java EE container such as TomEE, JBoss AS/EAP/WildFly, Payara/GlassFish, WebLogic, etc but not by barebones JSP/Servlet containers such as Tomcat and Jetty. For them, you'd need to supply JSTL along with the web application yourself, exactly like as you'd do for JSF (which is also already provided out the box by full fledged Java EE containers).
You're facing this exception because Facelets has for its <c:xxx> tags a dependency on the JSTL implementation JAR file, while you're using Tomcat which doesn't ship with JSTL out the box. JSTL is as a separate library available in flavor of jstl-1.2.jar. Just download and drop it in your webapp's /WEB-INF/lib folder, along with the JSF JAR file(s) which you already placed there, and this exception should disappear. Maven users can achieve that by adding the below dependency (and performing a full rebuild/redeploy):
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
Alternatively, just replace Tomcat by a real Java EE container.
See also:
Our JSF wiki page - contains JSF installation instructions
I just want to add my contribute if someone gets this error trying to create a springframework-4.0.7-RELEASE module for jboss-eap-6.4.0.GA. My module.xml now contains:
<dependencies>
...
<!-- Contains javax.servlet.jsp.jstl.core.Config -->
<module name="javax.servlet.jstl.api"/>
...
</dependencies>

java.lang.NoSuchMethodError: org.apache.tiles.TilesException: method <init>(Ljava/lang/String;Ljava/lang/Throwable;)V not found

Getting above error when starting my struts application.
The following is the export order.
/WEB-INF/src
/WEB-INF/lib/freemarker-2.3.16.jar
/WEB-INF/lib/javassist-3.7.ga.jar
/WEB-INF/lib/ognl-3.0.jar
JRE System library[jrocket... ]
/WEB-INF/lib/commons-beanutils-1.8.0.jar
/WEB-INF/lib/commons-digester-1.8.1.jar
/WEB-INF/lib/commons-fileupload-1.2.1.jar
/WEB-INF/lib/commons-io-1.3.2.jar
/WEB-INF/lib/commons-logging-1.0.4.jar
/WEB-INF/lib/commons-logging-api-1.1.jar
/WEB-INF/lib/log4j-1.2.14.jar
/WEB-INF/lib/struts2-config-browser-plugin-2.2.1.jar
/WEB-INF/lib/struts2-core-2.2.1.jar
/WEB-INF/lib/struts2-tiles-plugin-2.2.1.jar
/WEB-INF/lib/tiles-api-2.1.2.jar
/WEB-INF/lib/tiles-compat-2.1.2.jar
/WEB-INF/lib/tiles-jsp-2.1.2.jar
/WEB-INF/lib/tiles-servlet-2.1.2.jar
/WEB-INF/lib/xwork-core-2.2.1.jar
weblogic/api.jar
json-2010.01.05.jar
/WEB-INF/lib/tiles-core-2.1.2.jar
Please help. I will be very happy
2014-06-30 13:51:39,448 INFO org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:72 - Initializing Tiles2 application context. . .
2014-06-30 13:51:39,458 INFO org.apache.tiles.context.AbstractTilesApplicationContextFactory.createFactory:91 - Finished initializing Tiles2 application context.
2014-06-30 13:51:39,480 INFO org.apache.tiles.factory.TilesContainerFactory.initializeContainer:362 - Initializing Tiles2 container. . .
(Ljava/lang/String;Ljava/lang/Throwable;)V not found.
java.lang.NoSuchMethodError: org.apache.tiles.TilesException: method (Ljava/lang/String;Ljava/lang/Throwable;)V not found
at org.apache.tiles.factory.NotAvailableFeatureException.(NotAvailableFeatureException.java:71)
at org.apache.tiles.portlet.context.NotAPortletEnvironmentException.(NotAPortletEnvironmentException.java:71)
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.(PortletTilesRequestContextFactory.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
2014-06-30 13:51:39,524 INFO org.apache.tiles.servlet.context.ServletUtil.setContainer:151 - Removing TilesContext for context: weblogic.servlet.internal.WebAppServletContext
<Jun 30, 2014 1:51:39 PM EDT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1404150699134' for task '0'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: org.apache.tiles.TilesException: method <init>(Ljava/lang/String;Ljava/lang/Throwable;)V not found
at org.apache.tiles.factory.NotAvailableFeatureException.<init>(NotAvailableFeatureException.java:71)
at org.apache.tiles.portlet.context.NotAPortletEnvironmentException.<init>(NotAPortletEnvironmentException.java:71)
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(PortletTilesRequestContextFactory.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
<Jun 30, 2014 1:51:39 PM EDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 7 task for the application 'inhouse_brands'.>
<Jun 30, 2014 1:51:39 PM EDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating start task for application 'inhouse_brands'.>
<Jun 30, 2014 1:51:39 PM EDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException:
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: org.apache.tiles.TilesException: method <init>(Ljava/lang/String;Ljava/lang/Throwable;)V not found
at org.apache.tiles.factory.NotAvailableFeatureException.<init>(NotAvailableFeatureException.java:71)
at org.apache.tiles.portlet.context.NotAPortletEnvironmentException.<init>(NotAPortletEnvironmentException.java:71)
at org.apache.tiles.portlet.context.PortletTilesRequestContextFactory.<init>(PortletTilesRequestContextFactory.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
Add this jars in your WEB-INF/lib folder
commons-lang3-3.1.jar
commons-lang-2.4.jar
slf4j-api-x.x.x.jar
slf4j-log4j12-x.x.x.jar
log4j-x.x.x.jar
Most importantly this jar is not in your project, So first download it and add it to your build path.
tiles-core.2.x.x.jar
tiles-template-2.x.x.jar
tiles-portlet-2.x.x.jar
You can choose version by yourself as per your project need.e.g. commons-lang-x.x,jar. Also reply if you get error.
And if you are new user to stack overflow then I will suggest you to learn how to accept answer Please see click HERE
EDIT :
Also I would like to tell you that struts2-tiles-plugin-2.2.1.jar depends on tiles 2.0.6 not tiles 2.2.1. Well, it does not matter. But it was just for your information. You should use proper version of tiles which should be compatible with your struts. At least try once using compatible versions.
What your error says is a resource could not be used because it is not in a portlet environment.
I will suggest you to Learn portlet integration of tiles
You are missing tiles-portlet-2.x.x.jar or portlet-ext.xml file
Edit 2:
Check rt.jar in your JRE.
If you don't have it on your classpath you will not have access to any of those classes you need to use like java.lang.String or java.io.File.

Flume fails on config file

I have some code I inherited and there is little documentation. The system keeps failing on various errors. It seems to me it is not reading the jar files and I am not even sure where it is looking. Here is the error below. Can anyone offer any advice?
- Creating instance of source Twitter, type uk.co.senym.flume.TweetDataSource
13 Dec 2013 15:29:55,923 ERROR [conf-file-poller-0](org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run:142) - Failed to load configuration data. Exception follows.
org.apache.flume.FlumeException: Unable to load source type: uk.co.senym.flume.TweetDataSource, class: uk.co.senym.flume.TweetDataSource
at org.apache.flume.source.DefaultSourceFactory.getClass(DefaultSourceFactory.java:67)
at org.apache.flume.source.DefaultSourceFactory.create(DefaultSourceFactory.java:40)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:327)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:102)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: uk.co.senym.flume.TweetDataSource
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at org.apache.flume.source.DefaultSourceFactory.getClass(DefaultSourceFactory.java:65)
... 11 more
If you're using a recent version of Flume then you should use the plugins.d directory.
I'll assume for the moment you are using a Bigtop-derived distribution such as Cloudera CDH4. Then you want to take a look # /etc/flume-ng/conf/flume-env.sh to see if they were customizing the Flume classpath to point to the jar file for your custom twitter source.
That is the old way and it kinda sucks. A better way is to put your stuff into plugins.d as documented here: http://archive.cloudera.com/cdh4/cdh/4/flume-ng/FlumeUserGuide.html#installing-third-party-plugins
I believe the default plugins.d directory on CDH4 is /var/lib/flume-ng/plugins.d
HTH

RichFaces4 startup fails with java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.DoubleConverter

This seems not be not a simple task with RichFaces4 without Maven, I download myfaces-2.0.9 jars and richfaces 4.0.0 and added sac-1.3.jar, guava-r08.jar and cssparser-0.9.5.jar.
The environment I am working is Tomcat 6.0, But I am unable to setup a simple richfaces4 based web application when ever I run tomcat I get different issues. I added few jars related to the below error but I get another duplicate key error for another converter,
On an other note: I also had to remove tomohawk from tomcat as I was using myfaces. Please help.
java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.DoubleConverter
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:72)
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:221)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:207)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:68)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:62)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:43)
at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2144)
at org.apache.myfaces.application.ApplicationImpl.access$000(ApplicationImpl.java:118)
at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(ApplicationImpl.java:2334)
at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:554)
at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:254)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:139)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4172)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4671)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Oct 6, 2011 7:13:29 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 6, 2011 7:13:29 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/testRichFaces4] startup failed due to previous errors
Oct 6, 2011 7:13:29 PM org.apache.catalina.core.StandardContext listenerStop
SEVERE: Exception sending context destroyed event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.NullPointerException
at org.richfaces.application.CacheProvider.release(CacheProvider.java:86)
at org.richfaces.application.ServicesFactoryImpl.release(ServicesFactoryImpl.java:19)
at org.richfaces.application.ServiceTracker.release(ServiceTracker.java:100)
at org.richfaces.application.InitializationListener.onStop(InitializationListener.java:144)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:154)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:43)
at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2144)
at org.apache.myfaces.application.ApplicationImpl.access$000(ApplicationImpl.java:118)
at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(ApplicationImpl.java:2334)
at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:554)
at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:254)
at org.apache.myfaces.webapp.AbstractFacesInitializer.destroyFaces(AbstractFacesInitializer.java:285)
at org.apache.myfaces.webapp.StartupServletContextListener.contextDestroyed(StartupServletContextListener.java:153)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4211)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4846)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4716)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Oct 6, 2011 7:13:29 PM 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:804)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:108)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:327)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4211)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4846)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4716)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:701)
at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
This can happen if you also include the RichFaces source code JAR files in the classpath. They do not belong in the webapp's runtime classpath. It are the ones with a filename ending in -source.jar. You should remove them from the /WEB-INF/lib and put them if necessary somewhere else which do not end up in the webapp's runtime classpath.
The culprit is the csv.xml file which is present in /META-INF folder of both the richfaces-components-ui-4.0.0.Final.jar and richfaces-components-ui-4.0.0.Final-source.jar files. That file definies the standard converters and validators. However, because that file now appears twice in the classpath, it's been read twice, resulting in this duplicate key exception.
Unrelated to the concrete problem, removing Tomahawk because you're using MyFaces is a non-argument. The MyFaces JSF implementation does not contain the same components as Tomahawk. It's just another JSF implementation and technically the competitor of Mojarra. Tomahawk is a standalone component library which offers more enhanced components on top of the standard JSF implementation and can be used as good on top of every JSF implementation.

Resources