[Resolvido] Exception ao injetar um @Component numa classe @AplicationScoped

Olá pessoa!
Tenho uma classe anotada com @Component:

@Component
public class ParameterLoader {

	private final String PROPERTIES_NAME = "param.properties";
	private PropertiesLoader propertiesLoader;
	
	public ParameterLoader(ServletContext servletContext) {
		try {
			this.propertiesLoader = new PropertiesLoader(new FileInputStream(new File(servletContext.getRealPath("/WEB-INF/properties/" + this.PROPERTIES_NAME))));
		} catch (Exception exception) {
			throw new RuntimeException(exception);
		}
	}
	
	public String getParameter(String parameterName) {
		return this.propertiesLoader.getValue(parameterName);
	}
}

Esta classe é injetada na classe MyFirstApplicationTask que está anotada com @AplicationScoped

@Component
@ApplicationScoped
public class MyFirstApplicationTask implements ApplicationTask {
	
	private News news;
	private ParameterLoader parameterLoader;

	public MyFirstApplicationTask(TaskScheduler scheduler, News news,ServletContext servletContext,
			ParameterLoader parameterLoader) {
	        this.schedule(scheduler);
	        this.news = news;
	        this.parameterLoader = new ParameterLoader(servletContext);		        
	    }
	
	    public void schedule(TaskScheduler scheduler) {
	    	String agenda = this.parameterLoader.getParameter("scheduler.mail");
	        scheduler.schedule(this, new CronTrigger(agenda));
	    }
	    
		public void run(){				
		news.enviar();
	}
}

A exceção é:

00:35:24,785  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@407166: defining beans [pathAnnotationRoutesParser,encodingHandlerFactory,hibernateProxyInitializer,defaultDeserializers,paranamerNameProvider,asmBasedTypeCreator,JSR303ValidatorFactory,defaultConverters,defaultMultipartConfig,objenesisProxifier,defaultInterceptorHandlerFactory,defaultAcceptHeaderToFormat,validatorFactoryCreator,noRoutesConfiguration,defaultInterceptorRegistry,defaultMethodNotAllowedHandler,defaultRoutes,XStreamXMLDeserializer,defaultResourceNotFoundHandler,defaultTypeNameExtractor,defaultRouter,messageInterpolatorFactory,defaultTypeFinder,defaultRestDefaults,defaultResourceTranslator,stereotypeHandler,converterHandler,interceptorStereotypeHandler,deserializesHandler,stereotypedBeansRegistrar,defaultSpringLocator,downloadInterceptor,flashInterceptor,emptyResult,outjectResult,jstlLocalization,applicationConfiguration,defaultValidationViewsFactory,instantiateInterceptor,defaultRepresentationResult,JSR303Validator,forwardToDefaultViewInterceptor,defaultLogicResult,interceptorListPriorToExecutionExtractor,XStreamXMLSerialization,defaultFormatResolver,emptyElementsRemoval,exceptionHandlerInterceptor,ognlParametersProvider,parametersInstantiatorInterceptor,deserializingInterceptor,commonsUploadMultipartInterceptor,defaultResult,defaultRefererResult,defaultRestHeadersHandler,defaultExceptionMapper,defaultValidator,defaultMethodInfo,jsonDeserializer,resourceLookupInterceptor,replicatorOutjector,HTMLSerialization,defaultHttpResult,XStreamJSONSerialization,defaultStatus,executeMethodInterceptor,defaultPathResolver,defaultPageResult,primitiveIntConverter,uploadedFileConverter,primitiveByteConverter,doubleConverter,primitiveBooleanConverter,primitiveFloatConverter,primitiveCharConverter,localeBasedDateConverter,byteConverter,primitiveLongConverter,booleanConverter,localeBasedCalendarConverter,primitiveDoubleConverter,bigIntegerConverter,enumConverter,longConverter,characterConverter,integerConverter,bigDecimalConverter,shortConverter,primitiveShortConverter,floatConverter,VRaptorRequestProvider,httpServletRequestProvider,httpServletResponseProvider,httpSessionProvider,defaultInterceptorStack,defaultRequestExecution,entityManagerCreator,entityManagerFactoryCreator,JPATransactionInterceptor,noCacheInterceptor,relatorioDAO,usuarioDAO,fotoDAO,modalidadeDAO,tipoDAO,statusDAO,proprietarioDAO,roleDAO,contatoDAO,imovelDAO,municipioDAO,imagens,busca,jasperMaker,myFirstRequestTask,sendMail,customMultipartConfig,newsletter,parameterLoader,taskSchedulerFactory,myFirstApplicationTask,news,contatoController,proprietarioController,fotoController,municipioController,usuarioController,empresaController,tasksController,relatoriosController,modalidadeController,statusController,loginController,imovelController,indexController,homeController,tipoController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,localeBasedDoubleConverter,localeBasedBigDecimalConverter,localeBasedFloatConverter,org.springframework.aop.config.internalAutoProxyCreator,cacheBasedTypeCreator]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@6c1a82
00:35:24,786  INFO [ThreadPoolTaskScheduler] Shutting down ExecutorService
09/12/2010 00:35:24 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter vraptor
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myFirstApplicationTask' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/component/MyFirstApplicationTask.class]: Unsatisfied dependency expressed through constructor argument with index 3 of type [br.com.imobiliaria.component.ParameterLoader]: : Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:718)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:194)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:993)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:897)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:68)
	at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:82)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:110)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:103)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:269)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:250)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:368)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4193)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4801)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:339)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:838)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:780)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:784)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:711)
	... 40 more
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:123)
	at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:40)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
	... 46 more
09/12/2010 00:35:24 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
09/12/2010 00:35:24 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/imobiliaria] startup failed due to previous errors
09/12/2010 00:35:24 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
00:35:24,800  INFO [XmlWebApplicationContext] Closing Root WebApplicationContext: startup date [Thu Dec 09 00:35:21 BRST 2010]; root of context hierarchy
00:35:24,801  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6c1a82: defining beans [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#0,org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor#0,org.springframework.security.methodSecurityMetadataSourceAdvisor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.core.session.SessionRegistryImpl#0,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#1,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,org.springframework.security.provisioning.JdbcUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,dataSource]; root of factory hierarchy
09/12/2010 00:35:24 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/imobiliaria] registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
09/12/2010 00:35:24 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/imobiliaria] appears to have started a thread named [com.google.common.base.internal.Finalizer] but has failed to stop it. This is very likely to create a memory leak.

Onde eu estou errando? =/
Abraço!

Não tem como você injetar uma classe com um ciclo de vida menor em uma de ciclo maior, embora o inverso é possível.

Ou seja, nunca uma classe application-scoped pode receber uma request-scoped.

Beleza Garcia? o/
Então lascou, pq aquela classe pega a configuração de dia a hora pra enviar newsletter. =/
Como poderia resolver isso pelo VRaptor?
Abraço!

Acho que a ParameterLoader pode ser @ApplicationScoped tb, já que ela só depende do ServletContext q é AppScoped tb, daí resolve seu problema

Oi Lucas! o/
Infelizmente não deu boa, nem com @AplicationScoped e nem com @PrototypeScoped.

13:10:42,829 DEBUG [VRaptorApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@23d278]
13:10:42,833 DEBUG [VRaptorApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1cec874]
13:10:42,864  INFO [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c12474: defining beans [paranamerNameProvider,validatorFactoryCreator,pathAnnotationRoutesParser,defaultResourceNotFoundHandler,noRoutesConfiguration,messageInterpolatorFactory,asmBasedTypeCreator,defaultMethodNotAllowedHandler,defaultConverters,defaultAcceptHeaderToFormat,defaultTypeNameExtractor,encodingHandlerFactory,defaultRouter,defaultTypeFinder,objenesisProxifier,defaultRoutes,defaultResourceTranslator,JSR303ValidatorFactory,defaultMultipartConfig,defaultRestDefaults,hibernateProxyInitializer,defaultInterceptorHandlerFactory,defaultDeserializers,XStreamXMLDeserializer,defaultInterceptorRegistry,stereotypeHandler,converterHandler,interceptorStereotypeHandler,deserializesHandler,stereotypedBeansRegistrar,defaultSpringLocator,defaultResult,executeMethodInterceptor,defaultValidator,jsonDeserializer,deserializingInterceptor,HTMLSerialization,defaultHttpResult,defaultExceptionMapper,XStreamXMLSerialization,exceptionHandlerInterceptor,forwardToDefaultViewInterceptor,parametersInstantiatorInterceptor,XStreamJSONSerialization,commonsUploadMultipartInterceptor,emptyResult,replicatorOutjector,interceptorListPriorToExecutionExtractor,jstlLocalization,flashInterceptor,defaultRefererResult,defaultLogicResult,defaultRepresentationResult,applicationConfiguration,JSR303Validator,defaultRestHeadersHandler,emptyElementsRemoval,defaultFormatResolver,defaultPathResolver,instantiateInterceptor,defaultValidationViewsFactory,ognlParametersProvider,defaultStatus,defaultMethodInfo,resourceLookupInterceptor,downloadInterceptor,outjectResult,defaultPageResult,primitiveCharConverter,shortConverter,primitiveLongConverter,localeBasedDateConverter,booleanConverter,localeBasedCalendarConverter,primitiveByteConverter,longConverter,floatConverter,bigDecimalConverter,primitiveDoubleConverter,primitiveShortConverter,enumConverter,uploadedFileConverter,primitiveBooleanConverter,byteConverter,integerConverter,bigIntegerConverter,doubleConverter,primitiveIntConverter,primitiveFloatConverter,characterConverter,VRaptorRequestProvider,httpServletRequestProvider,httpServletResponseProvider,httpSessionProvider,defaultRequestExecution,defaultInterceptorStack,entityManagerCreator,entityManagerFactoryCreator,JPATransactionInterceptor,noCacheInterceptor,relatorioDAO,usuarioDAO,fotoDAO,modalidadeDAO,tipoDAO,statusDAO,proprietarioDAO,roleDAO,contatoDAO,imovelDAO,municipioDAO,imagens,busca,jasperMaker,sendMail,customMultipartConfig,newsletter,parameterLoader,taskSchedulerFactory,myFirstApplicationTask,news,contatoController,proprietarioController,fotoController,municipioController,usuarioController,empresaController,tasksController,relatoriosController,modalidadeController,statusController,loginController,imovelController,indexController,homeController,tipoController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,localeBasedDoubleConverter,localeBasedBigDecimalConverter,localeBasedFloatConverter,org.springframework.aop.config.internalAutoProxyCreator,cacheBasedTypeCreator]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@15db13f
13:10:42,994  INFO [ThreadPoolTaskScheduler] Initializing ExecutorService 
13:10:43,016 DEBUG [VRaptorApplicationContext] Cache miss for class br.com.imobiliaria.component.TaskSchedulerFactory
13:10:43,091  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c12474: defining beans [paranamerNameProvider,validatorFactoryCreator,pathAnnotationRoutesParser,defaultResourceNotFoundHandler,noRoutesConfiguration,messageInterpolatorFactory,asmBasedTypeCreator,defaultMethodNotAllowedHandler,defaultConverters,defaultAcceptHeaderToFormat,defaultTypeNameExtractor,encodingHandlerFactory,defaultRouter,defaultTypeFinder,objenesisProxifier,defaultRoutes,defaultResourceTranslator,JSR303ValidatorFactory,defaultMultipartConfig,defaultRestDefaults,hibernateProxyInitializer,defaultInterceptorHandlerFactory,defaultDeserializers,XStreamXMLDeserializer,defaultInterceptorRegistry,stereotypeHandler,converterHandler,interceptorStereotypeHandler,deserializesHandler,stereotypedBeansRegistrar,defaultSpringLocator,defaultResult,executeMethodInterceptor,defaultValidator,jsonDeserializer,deserializingInterceptor,HTMLSerialization,defaultHttpResult,defaultExceptionMapper,XStreamXMLSerialization,exceptionHandlerInterceptor,forwardToDefaultViewInterceptor,parametersInstantiatorInterceptor,XStreamJSONSerialization,commonsUploadMultipartInterceptor,emptyResult,replicatorOutjector,interceptorListPriorToExecutionExtractor,jstlLocalization,flashInterceptor,defaultRefererResult,defaultLogicResult,defaultRepresentationResult,applicationConfiguration,JSR303Validator,defaultRestHeadersHandler,emptyElementsRemoval,defaultFormatResolver,defaultPathResolver,instantiateInterceptor,defaultValidationViewsFactory,ognlParametersProvider,defaultStatus,defaultMethodInfo,resourceLookupInterceptor,downloadInterceptor,outjectResult,defaultPageResult,primitiveCharConverter,shortConverter,primitiveLongConverter,localeBasedDateConverter,booleanConverter,localeBasedCalendarConverter,primitiveByteConverter,longConverter,floatConverter,bigDecimalConverter,primitiveDoubleConverter,primitiveShortConverter,enumConverter,uploadedFileConverter,primitiveBooleanConverter,byteConverter,integerConverter,bigIntegerConverter,doubleConverter,primitiveIntConverter,primitiveFloatConverter,characterConverter,VRaptorRequestProvider,httpServletRequestProvider,httpServletResponseProvider,httpSessionProvider,defaultRequestExecution,defaultInterceptorStack,entityManagerCreator,entityManagerFactoryCreator,JPATransactionInterceptor,noCacheInterceptor,relatorioDAO,usuarioDAO,fotoDAO,modalidadeDAO,tipoDAO,statusDAO,proprietarioDAO,roleDAO,contatoDAO,imovelDAO,municipioDAO,imagens,busca,jasperMaker,sendMail,customMultipartConfig,newsletter,parameterLoader,taskSchedulerFactory,myFirstApplicationTask,news,contatoController,proprietarioController,fotoController,municipioController,usuarioController,empresaController,tasksController,relatoriosController,modalidadeController,statusController,loginController,imovelController,indexController,homeController,tipoController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,localeBasedDoubleConverter,localeBasedBigDecimalConverter,localeBasedFloatConverter,org.springframework.aop.config.internalAutoProxyCreator,cacheBasedTypeCreator]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@15db13f
13:10:43,093  INFO [ThreadPoolTaskScheduler] Shutting down ExecutorService
09/12/2010 13:10:43 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter vraptor
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myFirstApplicationTask' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/component/MyFirstApplicationTask.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.com.imobiliaria.component.MyFirstApplicationTask]: Constructor threw exception; nested exception is java.lang.NullPointerException
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:286)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:993)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:897)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:68)
	at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:82)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:110)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:103)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:269)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:250)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:368)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4193)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4801)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [br.com.imobiliaria.component.MyFirstApplicationTask]: Constructor threw exception; nested exception is java.lang.NullPointerException
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:105)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:278)
	... 39 more
Caused by: java.lang.NullPointerException
	at br.com.imobiliaria.component.MyFirstApplicationTask.schedule(MyFirstApplicationTask.java:28)
	at br.com.imobiliaria.component.MyFirstApplicationTask.<init>(MyFirstApplicationTask.java:22)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
	... 41 more
09/12/2010 13:10:43 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
09/12/2010 13:10:43 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/imobiliaria] startup failed due to previous errors
13:10:43,103  INFO [XmlWebApplicationContext] Closing Root WebApplicationContext: startup date [Thu Dec 09 13:10:39 BRST 2010]; root of context hierarchy
09/12/2010 13:10:43 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
13:10:43,104  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15db13f: defining beans [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#0,org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor#0,org.springframework.security.methodSecurityMetadataSourceAdvisor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.core.session.SessionRegistryImpl#0,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#1,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,org.springframework.security.provisioning.JdbcUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,dataSource]; root of factory hierarchy
09/12/2010 13:10:43 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/imobiliaria] registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
09/12/2010 13:10:43 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/imobiliaria] appears to have started a thread named [com.google.common.base.internal.Finalizer] but has failed to stop it. This is very likely to create a memory leak.

Valeu!

tah dando nullpointer:

Caused by: java.lang.NullPointerException  
    at br.com.imobiliaria.component.MyFirstApplicationTask.schedule(MyFirstApplicationTask.java:28)  
    at br.com.imobiliaria.component.MyFirstApplicationTask.<init>(MyFirstApplicationTask.java:22)  

OPs, esqueci de passar o servletContext por parâmetro, mas mesmo assim, não vai não:

14:01:22,482  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@c12474: defining beans [defaultDeserializers,defaultTypeFinder,messageInterpolatorFactory,defaultRouter,defaultResourceNotFoundHandler,JSR303ValidatorFactory,defaultRestDefaults,defaultTypeNameExtractor,encodingHandlerFactory,asmBasedTypeCreator,defaultResourceTranslator,defaultMultipartConfig,objenesisProxifier,noRoutesConfiguration,XStreamXMLDeserializer,defaultInterceptorHandlerFactory,defaultInterceptorRegistry,pathAnnotationRoutesParser,defaultRoutes,validatorFactoryCreator,defaultConverters,defaultMethodNotAllowedHandler,paranamerNameProvider,defaultAcceptHeaderToFormat,hibernateProxyInitializer,stereotypeHandler,converterHandler,interceptorStereotypeHandler,deserializesHandler,stereotypedBeansRegistrar,defaultSpringLocator,applicationConfiguration,emptyResult,defaultPathResolver,defaultValidationViewsFactory,deserializingInterceptor,forwardToDefaultViewInterceptor,XStreamXMLSerialization,defaultLogicResult,executeMethodInterceptor,resourceLookupInterceptor,defaultRestHeadersHandler,commonsUploadMultipartInterceptor,emptyElementsRemoval,defaultExceptionMapper,ognlParametersProvider,defaultStatus,replicatorOutjector,defaultResult,instantiateInterceptor,interceptorListPriorToExecutionExtractor,exceptionHandlerInterceptor,JSR303Validator,defaultPageResult,XStreamJSONSerialization,defaultRepresentationResult,defaultFormatResolver,downloadInterceptor,HTMLSerialization,defaultHttpResult,flashInterceptor,defaultRefererResult,jsonDeserializer,parametersInstantiatorInterceptor,outjectResult,defaultValidator,jstlLocalization,defaultMethodInfo,primitiveBooleanConverter,primitiveLongConverter,primitiveFloatConverter,integerConverter,bigDecimalConverter,floatConverter,longConverter,localeBasedCalendarConverter,doubleConverter,primitiveByteConverter,primitiveIntConverter,characterConverter,primitiveShortConverter,localeBasedDateConverter,bigIntegerConverter,uploadedFileConverter,enumConverter,byteConverter,shortConverter,primitiveDoubleConverter,primitiveCharConverter,booleanConverter,VRaptorRequestProvider,httpServletRequestProvider,httpServletResponseProvider,httpSessionProvider,defaultRequestExecution,defaultInterceptorStack,entityManagerCreator,entityManagerFactoryCreator,JPATransactionInterceptor,noCacheInterceptor,relatorioDAO,usuarioDAO,fotoDAO,modalidadeDAO,tipoDAO,statusDAO,proprietarioDAO,roleDAO,contatoDAO,imovelDAO,municipioDAO,imagens,busca,jasperMaker,sendMail,customMultipartConfig,newsletter,parameterLoader,taskSchedulerFactory,myFirstApplicationTask,news,contatoController,proprietarioController,fotoController,municipioController,usuarioController,empresaController,tasksController,relatoriosController,modalidadeController,statusController,loginController,imovelController,indexController,homeController,tipoController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,localeBasedDoubleConverter,localeBasedBigDecimalConverter,localeBasedFloatConverter,org.springframework.aop.config.internalAutoProxyCreator,cacheBasedTypeCreator]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@15db13f
14:01:22,482  INFO [ThreadPoolTaskScheduler] Shutting down ExecutorService
09/12/2010 14:01:22 org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter vraptor
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myFirstApplicationTask' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/component/MyFirstApplicationTask.class]: Unsatisfied dependency expressed through constructor argument with index 2 of type [br.com.imobiliaria.component.ParameterLoader]: : Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:718)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:194)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:993)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:897)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.start(SpringBasedContainer.java:68)
	at br.com.caelum.vraptor.ioc.spring.SpringProvider.start(SpringProvider.java:82)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:110)
	at br.com.caelum.vraptor.VRaptor.init(VRaptor.java:103)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:269)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:250)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:368)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4193)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4801)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:771)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:988)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:275)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:427)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:649)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:585)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:339)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:838)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:780)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:784)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:711)
	... 40 more
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
	at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:123)
	at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:40)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
	... 46 more
09/12/2010 14:01:22 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
09/12/2010 14:01:22 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/imobiliaria] startup failed due to previous errors
09/12/2010 14:01:22 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
14:01:22,512  INFO [XmlWebApplicationContext] Closing Root WebApplicationContext: startup date [Thu Dec 09 14:01:14 BRST 2010]; root of context hierarchy
14:01:22,513  INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15db13f: defining beans [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#0,org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor#0,org.springframework.security.methodSecurityMetadataSourceAdvisor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.core.session.SessionRegistryImpl#0,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#1,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.config.http.UserDetailsServiceInjectionBeanPostProcessor#0,org.springframework.security.filterChainProxy,org.springframework.security.provisioning.JdbcUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,dataSource]; root of factory hierarchy
09/12/2010 14:01:22 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/imobiliaria] registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
09/12/2010 14:01:22 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/imobiliaria] appears to have started a thread named [com.google.common.base.internal.Finalizer] but has failed to stop it. This is very likely to create a memory leak.

O estranho é que na stacktrace sugere pra mapear com escopo de request:

Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton

Já tentei com as três annotations possíveis, @PrototypeScoped, @ApplicationScoped e @RequestScoped no meu component ParameterLoader. =/

Isso está certo? Na classe MyFirstApplicationTask você passa no construtor o parametro parameterLoader, e ao mesmo tempo você logo após faz um new nesse objeto.

tem uma alternativa melhor pra isso…

vc pode colocar o param.properties numa source folder, e pra pegá-lo depois é só fazer

ParamLoader.class.getResourceAsStream("/param.properties");

assim vc não depende do ServletContext e o paramLoader pode ser @applicationScoped

Não têm uma outra forma de injetar esse component ao invés de alterar todo o código que já está funcionando? =/
O meu param.properies esta na WEB-INF/properties/param.properies, mesmo que eu altere o código, não vou poder injetar nenhum component em classe anotada com @ApplicationScoped né? Ai fica complicado, sou obrigado a deixar o código na pŕopria classe, arruinando a idéia de pegar os parametros em arquivo de texto.

não precisa alterar todo o código, só precisa alterar o ParameterLoader :wink:

o problema eh que a Task roda fora de uma requisição, portanto o Spring não consegue injetar o servletContext…

talvez se vc colocar o carregamento do properties num @PostConstruct funcione…

Tenta aí:

@Component  
@ApplicationScoped
public class ParameterLoader {  
  
    private final String PROPERTIES_NAME = "param.properties";  
    private PropertiesLoader propertiesLoader;  
    private ServletContext servletContext;

    public ParameterLoader(ServletContext servletContext) {  
        this.servletContext = servletContext;
    }
    @PostConstruct
    void loadProperties() {
        try {  
            this.propertiesLoader = new PropertiesLoader(new FileInputStream(new File(servletContext.getRealPath("/WEB-INF/properties/" + this.PROPERTIES_NAME))));  
        } catch (Exception exception) {  
            throw new RuntimeException(exception);  
        }  
    }  
      
    public String getParameter(String parameterName) {  
        return this.propertiesLoader.getValue(parameterName);  
    }  
}  

Tentei essa dica Lucas, tá dando NPE na linha:

String agenda = parameterLoader.getParameter("scheduler.mail");
@Component
@ApplicationScoped
public class ParameterLoader {

	 private final String PROPERTIES_NAME = "param.properties";  
	    private PropertiesLoader propertiesLoader;  
	    private ServletContext servletContext;

	    public ParameterLoader(ServletContext servletContext) {  
	        this.servletContext = servletContext;
	    }
	    @PostConstruct
	    public void loadProperties() {
	        try {  
	            this.propertiesLoader = new PropertiesLoader(new FileInputStream(new File(servletContext.getRealPath("/WEB-INF/properties/" + this.PROPERTIES_NAME))));  
	        } catch (Exception exception) {  
	            throw new RuntimeException(exception);  
	        }  
	    }  
	      
	    public String getParameter(String parameterName) {  
	        return this.propertiesLoader.getValue(parameterName);  
	}  
}

MyFirstApplicationTask

@Component
@ApplicationScoped
public class MyFirstApplicationTask implements ApplicationTask {
	
	private News news;
	private ParameterLoader parameterLoader;
	
	public MyFirstApplicationTask(TaskScheduler scheduler, News news, ParameterLoader parameterLoader) {
	        this.schedule(scheduler);
	        this.news = news;
	        this.parameterLoader = parameterLoader;
	    }
	
	    public void schedule(TaskScheduler scheduler) {
	    	String agenda = parameterLoader.getParameter("scheduler.mail");
	    	scheduler.schedule(this, new CronTrigger(agenda));
	    }
	    
		public void run(){				
		news.enviar();
	}
}

Garcia, eu tinha feito daquela forma pq precisava passar o servletContext pr parâmetro, o problema é esta classe anotada com @AplicationScoped.

o NPE é nessa linha:

String agenda = parameterLoader.getParameter("scheduler.mail");  

ou dentro do metodo getParameter?

Coloquei um breakpoint dentro do método loadProperies, parece que ele não está trazendo nada mesmo.

@PostConstruct
    void loadProperties() {
        try {  
            this.propertiesLoader = new PropertiesLoader(new FileInputStream(new File(servletContext.getRealPath("/WEB-INF/properties/" + this.PROPERTIES_NAME))));  // breakpoint nesta linha vem null
        } catch (Exception exception) {  
            throw new RuntimeException(exception);  
        }  
    }  

tenta por o loadProperties como público

Deixei como publico, mesmo assim continua o erro.

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myFirstApplicationTask' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/component/MyFirstApplicationTask.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [br.com.imobiliaria.tasks.News]: : Error creating bean with name 'news' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/tasks/News.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.imobiliaria.component.ParameterLoader]: : Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'news' defined in file [/home/bruno/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/imobiliaria/WEB-INF/classes/br/com/imobiliaria/tasks/News.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.imobiliaria.component.ParameterLoader]: : Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'parameterLoader': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request

Acho que a idéia do param.properties nesta classe não vai rolar…=/

se vc colocar o param.properties no classpath rola, como eu te disse antes…

daí vc consegue pegar com ParameterLoader.class.getResourceAsStream

Se eu entendi certo, a classe ParameterLoader ficaria assim?

@Component
@ApplicationScoped
public class ParameterLoader {
private PropertiesLoader propertiesLoader;  

    @PostConstruct
    public void loadProperties() {
        try {  
            this.propertiesLoader = new PropertiesLoader(ParameterLoader.class.getResourceAsStream("/param.properties"));  
        } catch (Exception exception) {  
            throw new RuntimeException(exception);  
        }  
    }  
      
    public String getParameter(String parameterName) {  
        return this.propertiesLoader.getValue(parameterName);  
    }  
}

Continua dando NPE, na linha do PropertiesLoader(ParameterLoader.class.getResourceAsStream("/param.properties")); vêm null.
A MyFirstApplicationTask deixei como estava:

@Component
@ApplicationScoped
public class MyFirstApplicationTask implements ApplicationTask {
	
	private News news;
	private ParameterLoader parameterLoader;
	
	public MyFirstApplicationTask(TaskScheduler scheduler, News news, ParameterLoader parameterLoader) {
	        this.schedule(scheduler);
	        this.news = news;
	        this.parameterLoader = parameterLoader;
	    }

	    public void schedule(TaskScheduler scheduler) {
	    	String agenda = parameterLoader.getParameter("scheduler.mail");
	    	scheduler.schedule(this, new CronTrigger(agenda));
	    }
	    
		public void run(){				
		news.enviar();
	}
} 

O param.properties deixei na /src.
Implementei certo a sua idéia Lucas?

isso, era essa a idéia…

sua pasta src é source folder?

tenta dar um clean no seu projeto, parece que tem lixo no classes

Eu deixei na pasta /src:

A linha para pegar o param.properies na classe ParameterLoader seria usando a própria classe ParameterLoader ou a outra classe PropertiesLoader?
Seria assim:

 this.propertiesLoader = new PropertiesLoader(ParameterLoader.class.getResourceAsStream("/param.properties"));

Ou assim:

 this.propertiesLoader = new PropertiesLoader(PropertiesLoader.class.getResourceAsStream("/param.properties"));

Digo isto pq tenho uma classe chamada PropertiesLoader:

public class PropertiesLoader {

	private final Properties properties = new Properties();
	
	public PropertiesLoader(String nomeProperties) throws IOException{
		InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(nomeProperties);
		this.properties.load(inputStream);
		inputStream.close();
	}
	
	public PropertiesLoader(InputStream inputStream) throws IOException{
		this.properties.load(inputStream);
		inputStream.close();
	}
	
	public String getValue(String key){  
        return (String)this.properties.getProperty(key);
	}  
	
}

A idéia seria que esta classe fizesse o stream do arquivo e mandasse de volta pro ParameterLoader, a sua idéia é fazer td diretamente na classe ParameterLoader?
Abraço!