Foi só eu postar a mensagem que consegui uma solução. É sempre assim?
O problema foi que ao criar a classe LoginInterceptor, apesar de implementar o método intercept, eu não coloquei “implements Interceptor”.
De qualquer forma obrigado.
Nelson
Caros Senhores
Estou estudando a apostila da Caelum do curso fj-21. Invariavelmente encontro alguma dificuldade que acabo conseguindo resolver, porém esta realmente não consegui.
Estava fazendo o exercício 12.8 - Interceptando as requisições. Quando inicio o servido dentro do Eclipse Galileo encontro a seguinte mensagem no console. Alguém saberia, por favor, dizer o porquê de o servidor não estar iniciando corretamente? Segue abaixo o console quando inicio servidor.
Obrigado,
Nelson
25/02/2010 02:47:33 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\php;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.6.0_04\bin
25/02/2010 02:47:33 org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
25/02/2010 02:47:33 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 704 ms
25/02/2010 02:47:33 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
25/02/2010 02:47:33 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.28
25/02/2010 02:47:33 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
25/02/2010 02:47:33 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
25/02/2010 02:47:34 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
25/02/2010 02:47:34 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]
25/02/2010 02:47:34 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Unable to find parent packages osgi-default
25/02/2010 02:47:35 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Unable to load config class br.com.caelum.tarefas.interceptor.LoginInterceptor at interceptor - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/wtpwebapps/tarefas/WEB-INF/classes/struts.xml:11:100 probably due to a missing jar, which might be fine if you never plan to use the LoginInterceptor interceptor
25/02/2010 02:47:35 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Actual exception
Caught Exception while registering Interceptor class br.com.caelum.tarefas.interceptor.LoginInterceptor - interceptor - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/wtpwebapps/tarefas/WEB-INF/classes/struts.xml:11:100
at org.apache.struts2.impl.StrutsObjectFactory.buildInterceptor(StrutsObjectFactory.java:77)
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:59)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.buildInterceptorList(DefaultInterceptorMapBuilder.java:99)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:90)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:74)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:796)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:586)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:318)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3666)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4258)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: Class [br.com.caelum.tarefas.interceptor.LoginInterceptor] does not implement Interceptor - interceptor - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%205.5/wtpwebapps/tarefas/WEB-INF/classes/struts.xml:11:100
at org.apache.struts2.impl.StrutsObjectFactory.buildInterceptor(StrutsObjectFactory.java:65)
... 32 more
25/02/2010 02:47:35 org.apache.catalina.core.ApplicationContext log
INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
25/02/2010 02:47:35 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
25/02/2010 02:47:35 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
25/02/2010 02:47:36 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
25/02/2010 02:47:36 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
25/02/2010 02:47:36 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
25/02/2010 02:47:36 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
25/02/2010 02:47:36 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/52 config=null
25/02/2010 02:47:36 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
25/02/2010 02:47:36 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3592 ms
Eu continuo com problemas nesse exercício. Parece que o tomcat não encontra o arquivo struts.xml no meu projeto. Tentei colocar o struts.xml junto com o arquivo web.xml e depois li que o local correto seria na raiz dos pacotes de classes, no diretório src mas o erro não mudou.
Senti falta da definição da localização do struts.xml que faziamos no Struts 1 dentro do arquivo web.xml, não sei se é esse o problema…
01/07/2010 13:26:59 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: C:\Arquivos de programas\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Arquivos de programas/Java/jre6/bin/client;C:/Arquivos de programas/Java/jre6/bin;C:\Inprise\vbroker\bin;C:\Arquivos de programas\Borland\Delphi7\Bin;C:\Arquivos de programas\Borland\Delphi7\Projects\Bpl\;C:\Arquivos de programas\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;.;C:\Arquivos de programas\Java\jdk1.6.0_07\bin;C:\Arquivos de programas\Microsoft SQL Server0\Tools\binn\;C:\Arquivos de programas\TortoiseSVN\bin;C:\maven\bin;C:\Arquivos de programas\Smart Projects\IsoBuster;C:\Arquivos de programas\Notepad++;C:\MinGW\bin;C:\Arquivos de programas\MySQL\MySQL Server 5.1\bin
01/07/2010 13:27:00 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:fj21-tarefas' did not find a matching property.
01/07/2010 13:27:00 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
01/07/2010 13:27:00 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 621 ms
01/07/2010 13:27:00 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
01/07/2010 13:27:00 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.26
01/07/2010 13:27:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-default.xml]
01/07/2010 13:27:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts-plugin.xml]
01/07/2010 13:27:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Unable to locate configuration files of the name struts.xml, skipping
01/07/2010 13:27:01 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
INFO: Parsing configuration file [struts.xml]
01/07/2010 13:27:02 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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)
Caused by: Unable to find interceptor class referenced by ref-name login - [unknown location]
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:52)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.buildInterceptorList(DefaultInterceptorMapBuilder.java:99)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:90)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:74)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:796)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:586)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:318)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 22 more
01/07/2010 13:27:02 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - [unknown location]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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)
Caused by: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 20 more
Caused by: Unable to find interceptor class referenced by ref-name login - [unknown location]
at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:52)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.buildInterceptorList(DefaultInterceptorMapBuilder.java:99)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:90)
at org.apache.struts2.convention.DefaultInterceptorMapBuilder.build(DefaultInterceptorMapBuilder.java:74)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.createActionConfig(PackageBasedActionConfigBuilder.java:796)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildConfiguration(PackageBasedActionConfigBuilder.java:586)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:318)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 22 more
01/07/2010 13:27:02 org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
01/07/2010 13:27:02 org.apache.catalina.core.StandardContext start
SEVERE: Context [/fj21-tarefas] startup failed due to previous errors
01/07/2010 13:27:02 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1fe571f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@109ea96]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
01/07/2010 13:27:02 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@83b1b]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@608760]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.