Olá pessoal…
Estou começando os trabalhos com o Spring e estou tendo dificuldades para integrar com o JSF!
Depois de algumas configurações, eu subi meu serviço e foi exibida e seguinte mensagem de erro no console:
19/04/2012 15:47:40 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Desenvolvimento\Runtime\jdk\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:/Desenvolvimento/runtime/jdk/bin/../jre/bin/server;D:/Desenvolvimento/runtime/jdk/bin/../jre/bin;D:/Desenvolvimento/runtime/jdk/bin/../jre/lib/amd64;D:\Desenvolvimento\runtime\jdk\bin;D:\Desenvolvimento\runtime\jdk\jre\bin;D:\Desenvolvimento\runtime\apache-ant\bin;D:\Desenvolvimento\databases\JavaDB\bin;.;D:\Desenvolvimento\runtime\jdk;D:\Desenvolvimento\runtime\jdk\jre;D:\Desenvolvimento\runtime\tomcat;D:\Desenvolvimento\runtime\tomcat;D:\Desenvolvimento\runtime\tomcat\lib\;D:\Desenvolvimento\runtime\jetty;D:\Desenvolvimento\runtime\apache-ant;D:\Desenvolvimento\runtime\jdk\lib\tools.jar;D:\Desenvolvimento\runtime\tomcat\lib\servlet-api.jar;;D:\Desenvolvimento\databases\PostgreSQL;D:\Desenvolvimento\databases\PostgreSQL\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\Common Files\Microsoft Shared\Windows Live;B:\;C:\;D:\;E:\;F:\;D:\Desenvolvimento\Runtime\android-sdk\platform-tools\;;D:\Desenvolvimento\java\ide\eclipse helios;;.
19/04/2012 15:47:40 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:sicp' did not find a matching property.
19/04/2012 15:47:40 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVISO: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ce_jsf' did not find a matching property.
19/04/2012 15:47:40 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
19/04/2012 15:47:40 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
19/04/2012 15:47:40 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 654 ms
19/04/2012 15:47:40 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
19/04/2012 15:47:40 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
19/04/2012 15:47:45 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
19/04/2012 15:47:45 org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
19/04/2012 15:47:45 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:270)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
... 12 more
19/04/2012 15:47:45 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.0.3 (FCS b03) para o contexto '/ce_jsf'
19/04/2012 15:47:46 com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
19/04/2012 15:47:46 com.sun.faces.config.ConfigManager initialize
INFO: Unsanitized stacktrace from failed start...
com.sun.faces.config.ConfigurationException:
Source Document: jndi:/localhost/ce_jsf/WEB-INF/faces-config.xml
Cause: Class 'org.springframework.web.jsf.el.SpringBeanFacesELResolver' is missing a runtime dependency: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:275)
at com.sun.faces.config.processor.ApplicationConfigProcessor.addELResolver(ApplicationConfigProcessor.java:556)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:294)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:110)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:112)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:110)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:212)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:332)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:220)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.beans.factory.access.el.SpringBeanELResolver.<init>(SpringBeanELResolver.java:43)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.<init>(SpringBeanFacesELResolver.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:264)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
... 27 more
19/04/2012 15:47:46 org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.apache.commons.logging.LogFactory
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:351)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:220)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
at org.springframework.beans.factory.access.el.SpringBeanELResolver.<init>(SpringBeanELResolver.java:43)
at org.springframework.web.jsf.el.SpringBeanFacesELResolver.<init>(SpringBeanFacesELResolver.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.faces.config.processor.AbstractConfigProcessor.createInstance(AbstractConfigProcessor.java:264)
at com.sun.faces.config.processor.ApplicationConfigProcessor.addELResolver(ApplicationConfigProcessor.java:556)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:294)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:110)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:112)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:110)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:212)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:332)
... 11 more
19/04/2012 15:47:46 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
19/04/2012 15:47:46 org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/ce_jsf] startup failed due to previous errors
19/04/2012 15:47:46 com.sun.faces.config.ConfigureListener contextDestroyed
GRAVE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: O aplicativo não foi iniciado corretamente na inicialização. Não foi possível encontrar Fábrica: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:800)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:302)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:312)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
19/04/2012 15:47:46 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
19/04/2012 15:47:46 org.apache.catalina.core.StandardContext listenerStop
GRAVE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.web.context.ContextCleanupListener.<clinit>(ContextCleanupListener.java:43)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:144)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4819)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5466)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
... 13 more
19/04/2012 15:47:46 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
GRAVE: The web application [/ce_jsf] created a ThreadLocal with key of type [com.sun.faces.util.Util$1] (value [com.sun.faces.util.Util$1@f1d5566]) and a value of type [java.util.HashMap] (value [{com.sun.faces.patternCache={ = }}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
19/04/2012 15:47:46 org.apache.catalina.startup.ContextConfig webConfig
GRAVE: Unable to determine URL for WEB-INF/classes
javax.naming.NameNotFoundException: Resource /WEB-INF/classes not found
at org.apache.naming.resources.BaseDirContext.listBindings(BaseDirContext.java:733)
at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirContext.java:546)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1197)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:825)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:300)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
19/04/2012 15:47:46 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
19/04/2012 15:47:46 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
19/04/2012 15:47:46 org.apache.catalina.startup.Catalina start
INFO: Server startup in 6376 ms
O código do arquivo faces-config.xml que se refere o erro é o seguinte:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<!-- Integração do JSF/Spring -->
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<managed-bean>
<managed-bean-name>departamentoMBean</managed-bean-name>
<managed-bean-class>br.com.ce.bean.DepartamentoMBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>equipamentoMBean</managed-bean-name>
<managed-bean-class>br.com.ce.bean.EquipamentoMBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>funcionarioMBean</managed-bean-name>
<managed-bean-class>br.com.ce.bean.FuncionarioMBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>selectOneMenuMBean</managed-bean-name>
<managed-bean-class>br.com.ce.bean.SelectOneMenuMBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>listaEquipamento</from-outcome>
<to-view-id>/listaEquipamento.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>listaDepartamento</from-outcome>
<to-view-id>/listaDepartamento.xhtml</to-view-id>
<redirect/>
</navigation-case>
<navigation-case>
<from-outcome>listaFuncionario</from-outcome>
<to-view-id>/listaFuncionario.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
</faces-config>
O que estou esquecendo de configurar? Alguém pode me ajudar?