Pessoal,
Atualmente tenho um sistema com os seguintes frameworks: Adobe Flex 3 + Pure MVC + Hibernate + Spring Security e está funcionando muito bem, com algumas resalvas sobre o flex, muita dificuldade em desenvolver coisas simples e falta de profissionais no mercado. Analisando o cenário dos sistema WEB 2.0 para grandes corporações e prazos cada vez mais curtos, comecei a pesquisar e indicação de um grande amigo comecei a brincar com o VRaptor 3.
Fiz vários testes isoldos, sem muita complexidade, integrei com outros framework como Hibernate e JQuery e gostei muito do resultado e da produtividade.
Comecei então paralelamente a migrar o sistema. Comecei fazendo um merge das libs e substituindo o Spring 2.5 para o 3.0 que já vem no VRaptor, só ai foi uma boa parte do meu dia, porém quando resolvi os problemas de dependencia de configurações comecei a ter o seguinte erro quando subo o servidor (Tomcat 6)
ERRO:
09/06/2010 23:28:05 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:vraptor-blank-project' did not find a matching property.
09/06/2010 23:28:05 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:\java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Java/jre6/bin/client;C:/Java/jre6/bin;C:\Program Files\Common Files\ArcSoft\Bin;C:\PHP\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\java\ant-1.8.1\bin;C:\java\jdk1.6.0_14\bin;
09/06/2010 23:28:05 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
09/06/2010 23:28:05 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 524 ms
09/06/2010 23:28:05 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
09/06/2010 23:28:05 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
23:28:06,604 INFO [ContextLoader ] Root WebApplicationContext: initialization started
09/06/2010 23:28:06 org.apache.catalina.core.ApplicationContext log
INFO: Set web app root system property: 'root-eInsurance' = [C:\Eduardo\Projetos\pessoal\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\einsurance-v2\]
09/06/2010 23:28:06 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
23:28:06,725 INFO [XmlWebApplicationContext] Refreshing Root WebApplicationContext: startup date [Wed Jun 09 23:28:06 BRT 2010]; root of context hierarchy
23:28:06,887 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [config/spring-security-config.xml]
23:28:07,136 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.PortMapperImpl#0': replacing [Root bean: class [org.springframework.security.web.PortMapperImpl]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.PortMapperImpl]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,149 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.context.HttpSessionSecurityContextRepository#0': replacing [Root bean: class [org.springframework.security.web.context.HttpSessionSecurityContextRepository]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.context.HttpSessionSecurityContextRepository]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,162 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0': replacing [Root bean: class [org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,173 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.authentication.ProviderManager#0': replacing [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,197 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.access.vote.AffirmativeBased#0': replacing [Root bean: class [org.springframework.security.access.vote.AffirmativeBased]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.access.vote.AffirmativeBased]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,204 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0': replacing [Root bean: class [org.springframework.security.web.access.intercept.FilterSecurityInterceptor]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.access.intercept.FilterSecurityInterceptor]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,208 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0': replacing [Root bean: class [org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,239 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.authentication.AnonymousAuthenticationProvider#0': replacing [Root bean: class [org.springframework.security.authentication.AnonymousAuthenticationProvider]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.AnonymousAuthenticationProvider]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,246 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.savedrequest.HttpSessionRequestCache#0': replacing [Root bean: class [org.springframework.security.web.savedrequest.HttpSessionRequestCache]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.savedrequest.HttpSessionRequestCache]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,257 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0': replacing [Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,274 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': replacing [Root bean: class [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,298 INFO [HttpSecurityBeanDefinitionParser] Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 300, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, Root bean: class [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 800, Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1300, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1600, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1800, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 1900]
23:28:07,298 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.filterChainProxy': replacing [Root bean: class [org.springframework.security.web.FilterChainProxy]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.web.FilterChainProxy]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,326 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0': replacing [Root bean: class [org.springframework.security.authentication.dao.DaoAuthenticationProvider]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.dao.DaoAuthenticationProvider]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,331 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0': replacing [Root bean: class [org.springframework.security.authentication.DefaultAuthenticationEventPublisher]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.DefaultAuthenticationEventPublisher]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,332 INFO [DefaultListableBeanFactory] Overriding bean definition for bean 'org.springframework.security.authenticationManager': replacing [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [org.springframework.security.authentication.ProviderManager]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
23:28:07,337 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [config/spring-application-context.xml]
23:28:08,136 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [config/spring-application-daos.xml]
23:28:08,166 INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [config/spring-application-services.xml]
23:28:10,332 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15b0bc6: defining beans [org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#0,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.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,loggerListener,br.com.tratomais.core.util.log.LoggerEventListener#0,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,loggerAopListener,serviceEinsuranceInterceptor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,dataSource,sessionFactory,transactionManager,transactionAttributes,autoProxyCreator,loggedEventListener,contextApplicationContextProvider,messageSource,localeResolver,daoBean,daoLogin,daoUser,daoDomain,daoPartner,daoRole,daoModule,daoBroker,daoSubsidiary,daoChannel,daoInsurer,daoUserPartner,daoCity,daoCoutry,daoState,daoProduct,daoDataOption,daoProductVersion,daoPlan,daoCoverage,daoCoveragePlan,daoObject,daoPolicy,daoConversionRate,daoCalculo,daoMasterPolicy,daoPersonalRiskOption,daoCertificateReport,daoHistoryPendency,daoLockPendency,daoPayment,einsuranceServicesDAO,serviceEinsurance,serviceLogin,serviceUser,serviceDomain,servicePartner,serviceModule,serviceBroker,serviceSubsidiary,serviceChannel,serviceRole,serviceInsurer,serviceUserPartner,serviceCity,serviceCountry,serviceState,serviceUtil,serviceDataOption,serviceProfile,serviceProduct,servicePolicy,serviceBasicCalc,serviceMasterPolicy,servicePersonalRiskOption,serviceCertificateReport,serviceCalc,serviceProductVersion,serviceCollection,eInsuranceServices]; root of factory hierarchy
23:28:10,839 INFO [FilterSecurityInterceptor] Validated configuration attributes
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
log4j:WARN Please initialize the log4j system properly.
23:28:14,650 INFO [LocalSessionFactoryBean] Building new Hibernate SessionFactory
23:28:17,478 INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@15b0bc6: defining beans [org.springframework.security.web.PortMapperImpl#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.access.vote.AffirmativeBased#0,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.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager,loggerListener,br.com.tratomais.core.util.log.LoggerEventListener#0,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,loggerAopListener,serviceEinsuranceInterceptor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,dataSource,sessionFactory,transactionManager,transactionAttributes,autoProxyCreator,loggedEventListener,contextApplicationContextProvider,messageSource,localeResolver,daoBean,daoLogin,daoUser,daoDomain,daoPartner,daoRole,daoModule,daoBroker,daoSubsidiary,daoChannel,daoInsurer,daoUserPartner,daoCity,daoCoutry,daoState,daoProduct,daoDataOption,daoProductVersion,daoPlan,daoCoverage,daoCoveragePlan,daoObject,daoPolicy,daoConversionRate,daoCalculo,daoMasterPolicy,daoPersonalRiskOption,daoCertificateReport,daoHistoryPendency,daoLockPendency,daoPayment,einsuranceServicesDAO,serviceEinsurance,serviceLogin,serviceUser,serviceDomain,servicePartner,serviceModule,serviceBroker,serviceSubsidiary,serviceChannel,serviceRole,serviceInsurer,serviceUserPartner,serviceCity,serviceCountry,serviceState,serviceUtil,serviceDataOption,serviceProfile,serviceProduct,servicePolicy,serviceBasicCalc,serviceMasterPolicy,servicePersonalRiskOption,serviceCertificateReport,serviceCalc,serviceProductVersion,serviceCollection,eInsuranceServices]; root of factory hierarchy
23:28:17,492 INFO [LocalSessionFactoryBean] Closing Hibernate SessionFactory
23:28:17,500 ERROR [ContextLoader ] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoBean' defined in class path resource [config/spring-application-daos.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
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:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoConfig(HibernateDaoSupport.java:118)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
... 27 more
09/06/2010 23:28:17 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoBean' defined in class path resource [config/spring-application-daos.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1401)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
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:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoConfig(HibernateDaoSupport.java:118)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
... 27 more
09/06/2010 23:28:17 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
09/06/2010 23:28:17 org.apache.catalina.core.StandardContext start
SEVERE: Context [/einsurance-v2] startup failed due to previous errors
09/06/2010 23:28:17 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
09/06/2010 23:28:17 org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
09/06/2010 23:28:18 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
09/06/2010 23:28:18 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
09/06/2010 23:28:18 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/97 config=null
09/06/2010 23:28:18 org.apache.catalina.startup.Catalina start
INFO: Server startup in 12933 ms
Abaixo mando os meus arquivos de configuração para ver se os senhores conseguem me ajudar e terminar meu trabalho de avaliação de migração, já que o sistema atual está em pleno funcionamento é grande e está rodando em uma seguradora de peso.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>einsurance-v2</display-name>
<filter>
<filter-name>vraptor</filter-name>
<filter-class>br.com.caelum.vraptor.VRaptor</filter-class>
</filter>
<!-- Context param do contexto do spring e do spring security -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/config/spring-security-config.xml,
classpath:/config/spring-application-context.xml,
classpath:/config/spring-application-daos.xml,
classpath:/config/spring-application-services.xml
</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>root-eInsurance</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.security.web.session.HttpSessionEventPublisher
</listener-class>
</listener>
<!-- Listener do spring security -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- spring-security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Spring Hibernate Filter -->
<filter>
<filter-name>hibernateSessionFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/einsurancedb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<filter-mapping>
<filter-name>vraptor</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
</web-app>
spring-application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<!-- Spring Aspect -->
<aop:aspectj-autoproxy />
<context:annotation-config />
<context:component-scan base-package="br.com.tratomais" />
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/einsurancedb" />
<property name="resourceRef" value="true" />
</bean>
<!-- Hibernate Session Factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" autowire="default">
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="configLocations">
<value>classpath:config/hibernate-config.cfg.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<!-- Gerenciamento de transações -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" autowire="default">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="transactionAttributes" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<value>
add*=PROPAGATION_REQUIRED
save*=PROPAGATION_REQUIRED
update*=PROPAGATION_REQUIRED
delete*=PROPAGATION_REQUIRED
move*=PROPAGATION_REQUIRED
simpleCalc=PROPAGATION_REQUIRED
propertyCalc=PROPAGATION_REQUIRED
lifeCycleCalc=PROPAGATION_REQUIRED
effectiveProposal=PROPAGATION_REQUIRED
changeUserPassword=PROPAGATION_REQUIRED
unlockEndorsement=PROPAGATION_REQUIRED
baixaParcela=PROPAGATION_REQUIRED
*=PROPAGATION_REQUIRED,readOnly
</value>
</property>
</bean>
<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>service*</value>
<value>EInsuranceServices*</value>
</list>
</property>
</bean>
<bean id="loggedEventListener" class="br.com.tratomais.core.util.log.LoggerEventListener" />
<bean id="contextApplicationContextProvider" class="br.com.tratomais.core.util.ApplicationContextProvider" />
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource" p:basenames="messages" />
<!-- Declare the Resolver -->
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />
</beans>
spring-application-daos.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="daoBean" class="br.com.tratomais.core.dao.impl.DaoBeanImpl" autowire="default" />
<bean id="daoLogin" class="br.com.tratomais.core.dao.impl.DaoLoginImpl" autowire="default" />
<bean id="daoUser" class="br.com.tratomais.core.dao.impl.DaoUserImpl" autowire="default" />
<bean id="daoDomain" class="br.com.tratomais.core.dao.impl.DaoDomainImpl" autowire="default" />
<bean id="daoPartner" class="br.com.tratomais.core.dao.impl.DaoPartnerImpl" autowire="default" />
<bean id="daoRole" class="br.com.tratomais.core.dao.impl.DaoRoleImpl" autowire="default" />
<bean id="daoModule" class="br.com.tratomais.core.dao.impl.DaoModuleImpl" autowire="default" />
<bean id="daoBroker" class="br.com.tratomais.core.dao.impl.DaoBrokerImpl" autowire="default" />
<bean id="daoSubsidiary" class="br.com.tratomais.core.dao.impl.DaoSubsidiaryImpl" autowire="default" />
<bean id="daoChannel" class="br.com.tratomais.core.dao.impl.DaoChannelImpl" autowire="default" />
<bean id="daoInsurer" class="br.com.tratomais.core.dao.impl.DaoInsurerImpl" autowire="default" />
<bean id="daoUserPartner" class="br.com.tratomais.core.dao.impl.DaoUserPartnerImpl" autowire="default" />
<bean id="daoCity" class="br.com.tratomais.core.dao.impl.DaoCityImpl" autowire="default" />
<bean id="daoCoutry" class="br.com.tratomais.core.dao.impl.DaoCountryImpl" autowire="default" />
<bean id="daoState" class="br.com.tratomais.core.dao.impl.DaoStateImpl" autowire="default" />
<bean id="daoProduct" class="br.com.tratomais.core.dao.impl.DaoProductImpl" autowire="default" />
<bean id="daoDataOption" class="br.com.tratomais.core.dao.impl.DaoDataOptionImpl" autowire="default" />
<bean id="daoProductVersion" class="br.com.tratomais.core.dao.impl.DaoProductVersionImpl" autowire="default" />
<bean id="daoPlan" class="br.com.tratomais.core.dao.impl.DaoPlanImpl" autowire="default" />
<bean id="daoCoverage" class="br.com.tratomais.core.dao.impl.DaoCoverageImpl" autowire="default" />
<bean id="daoCoveragePlan" class="br.com.tratomais.core.dao.impl.DaoCoveragePlanImpl" autowire="default" />
<bean id="daoObject" class="br.com.tratomais.core.dao.impl.DaoObjectImpl" autowire="default" />
<bean id="daoPolicy" class="br.com.tratomais.core.dao.impl.DaoPolicyImpl" autowire="default" />
<bean id="daoConversionRate" class="br.com.tratomais.core.dao.impl.DaoConversionRateImpl" autowire="default" />
<bean id="daoCalculo" class="br.com.tratomais.core.dao.impl.DaoCalculo" autowire="default" />
<bean id="daoMasterPolicy" class="br.com.tratomais.core.dao.impl.DaoMasterPolicyImpl" autowire="default" />
<bean id="daoPersonalRiskOption" class="br.com.tratomais.core.dao.impl.DaoPersonalRiskOption" autowire="default" />
<bean id="daoCertificateReport" class="br.com.tratomais.core.dao.impl.DaoCertificateReportImpl" autowire="default" />
<bean id="daoHistoryPendency" class="br.com.tratomais.core.dao.impl.DaoHistoryPendency" autowire="default" />
<bean id="daoLockPendency" class="br.com.tratomais.core.dao.impl.DaoLockPendency" autowire="default" />
<bean id="daoPayment" class="br.com.tratomais.core.dao.impl.DaoPayment" autowire="default" />
<bean id="einsuranceServicesDAO" class="br.com.tratomais.core.soap.dao.EInsuranceServicesDAO" autowire="default" />
</beans>
spring-application-services.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="serviceEinsurance" class="br.com.tratomais.core.service.impl.ServiceEinsuranceImpl" autowire="default" />
<bean id="serviceLogin" class="br.com.tratomais.core.service.impl.ServiceLoginImpl" autowire="default" />
<bean id="serviceUser" class="br.com.tratomais.core.service.impl.ServiceUserImpl" autowire="default" />
<bean id="serviceDomain" class="br.com.tratomais.core.service.impl.ServiceDomainImpl" autowire="default" />
<bean id="servicePartner" class="br.com.tratomais.core.service.impl.ServicePartnerImpl" autowire="default" />
<bean id="serviceModule" class="br.com.tratomais.core.service.impl.ServiceModuleImpl" autowire="default" />
<!-- <bean id="serviceApplication" class="br.com.tratomais.core.service.impl.ServiceApplicationImpl" autowire="autodetect" />-->
<bean id="serviceBroker" class="br.com.tratomais.core.service.impl.ServiceBrokerImpl" autowire="default" />
<bean id="serviceSubsidiary" class="br.com.tratomais.core.service.impl.ServiceSubsidiaryImpl" autowire="default" />
<bean id="serviceChannel" class="br.com.tratomais.core.service.impl.ServiceChannelImpl" autowire="default" />
<bean id="serviceRole" class="br.com.tratomais.core.service.impl.ServiceRoleImpl" autowire="default" />
<bean id="serviceInsurer" class="br.com.tratomais.core.service.impl.ServiceInsurerImpl" autowire="default" />
<bean id="serviceUserPartner" class="br.com.tratomais.core.service.impl.ServiceUserPartnerImpl" autowire="default" />
<bean id="serviceCity" class="br.com.tratomais.core.service.impl.ServiceCityImpl" autowire="default" />
<bean id="serviceCountry" class="br.com.tratomais.core.service.impl.ServiceCountryImpl" autowire="default" />
<bean id="serviceState" class="br.com.tratomais.core.service.impl.ServiceStateImpl" autowire="default" />
<bean id="serviceUtil" class="br.com.tratomais.core.service.impl.ServiceUtilImpl" autowire="default" />
<bean id="serviceDataOption" class="br.com.tratomais.core.service.impl.ServiceDataOptionImpl" autowire="default" />
<bean id="serviceProfile" class="br.com.tratomais.core.service.impl.ServiceProfileImpl" autowire="default" />
<bean id="serviceProduct" class="br.com.tratomais.core.service.impl.ServiceProductImpl" autowire="default" />
<bean id="servicePolicy" class="br.com.tratomais.core.service.impl.ServicePolicyImpl" autowire="default" />
<bean id="serviceBasicCalc" class="br.com.tratomais.core.service.impl.BasicCalculationService" autowire="default" />
<bean id="serviceMasterPolicy" class="br.com.tratomais.core.service.impl.ServiceMasterPolicyImpl" autowire="default" />
<bean id="servicePersonalRiskOption" class="br.com.tratomais.core.service.impl.ServicePersonalRiskOption" autowire="default" />
<bean id="serviceCertificateReport" class="br.com.tratomais.core.service.impl.ServiceCertificateReportImpl" autowire="default" />
<bean id="serviceCalc" class="br.com.tratomais.core.service.impl.ServiceCalcImpl" autowire="default" />
<bean id="serviceProductVersion" class="br.com.tratomais.core.service.impl.ServiceProductVersionImpl" autowire="default" />
<bean id="serviceCollection" class="br.com.tratomais.core.service.impl.ServiceCollectionImpl" autowire="default" />
<bean id="eInsuranceServices" class="br.com.tratomais.core.soap.EInsuranceServicesImpl" autowire="default"/>
</beans>
spring-security-config.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http auto-config="true" access-denied-page="/einsurance.html">
<intercept-url pattern="/css/**" filters="none"/>
<intercept-url pattern="/login.jsp*" filters="none"/>
<intercept-url pattern="/manuals/einsurance_mo_web/*.htm" filters="none" />
<intercept-url pattern="/manuals/einsurance_mt_web/*.htm" filters="none" />
<intercept-url pattern="/services/*" filters="none"/>
<form-login login-page='/login.jsp'/>
</http>
<authentication-manager>
<authentication-provider user-service-ref="serviceProfile">
<password-encoder hash="sha" />
</authentication-provider>
</authentication-manager>
<beans:bean id="loggerListener" class="org.springframework.security.authentication.event.LoggerListener"/>
<beans:bean class="br.com.tratomais.core.util.log.LoggerEventListener" />
</beans:beans>
PersistentEntity.java
package br.com.tratomais.core.dao;
import java.io.Serializable;
public interface PersistentEntity extends Serializable {
}
IDaoBean.java
package br.com.tratomais.core.dao;
import java.io.Serializable;
@SuppressWarnings("unchecked")
public interface IDaoBean {
PersistentEntity load(Class clazz, Serializable id);
}
DaoBeanImpl.java
package br.com.tratomais.core.dao.impl;
import java.io.Serializable;
import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import br.com.caelum.vraptor.ioc.Component;
import br.com.tratomais.core.dao.IDaoBean;
import br.com.tratomais.core.dao.PersistentEntity;
@SuppressWarnings("unchecked")
@Component
public class DaoBeanImpl extends HibernateDaoSupport implements IDaoBean {
private static final Logger logger = Logger.getLogger( DaoBeanImpl.class );
public DaoBeanImpl() {
super();
}
public PersistentEntity load(Class clazz, Serializable id) {
return (PersistentEntity) super.getHibernateTemplate().load(clazz, id);
}
}
IDaoGeneric.java
package br.com.tratomais.core.dao;
import java.util.List;
public interface IDaoGeneric<T extends PersistentEntity, ID> {
T findById(ID id);
List<T> listAll();
List<T> listAllActive();
T save(T entity);
void delete(T entity);
}
DaoGenericImpl.java
package br.com.tratomais.core.dao.impl;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import br.com.tratomais.core.dao.IDaoGeneric;
import br.com.tratomais.core.dao.PersistentEntity;
@SuppressWarnings("unchecked")
public abstract class DaoGenericImpl<T extends PersistentEntity, ID extends Serializable> extends HibernateDaoSupport implements IDaoGeneric<T, ID> {
private static final Logger logger = Logger.getLogger( DaoGenericImpl.class );
private static Log LOG = LogFactory.getLog(DaoGenericImpl.class);
public DaoGenericImpl() {
super();
this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
}
public DaoGenericImpl(Class<T> clazz) {
super();
this.persistentClass = clazz;
}
private Class<T> persistentClass;
public Class<T> getPersistentClass() {
return this.persistentClass;
}
public void setPersistentClass(Class<T> clazz) {
this.persistentClass = clazz;
}
public void delete(T entity) {
try {
super.getHibernateTemplate().delete(entity);
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
}
}
public T findById(ID id) {
try {
return (T) super.getHibernateTemplate().get(getPersistentClass(), id);
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
throw new HibernateException(ex);
}
}
public List<T> listAll() {
try {
return super.getHibernateTemplate().loadAll(getPersistentClass());
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
throw new HibernateException(ex);
}
}
public List<T> listAllActive() {
try {
Criteria crit = this.createCriteria();
BeanInfo beanInfo = Introspector.getBeanInfo(getPersistentClass());
for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
if (propertyDescriptor.getName().equals("active")) {
crit.add(Restrictions.eq("active", true));
break;
}
}
return crit.list();
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
throw new HibernateException(ex);
} catch (IntrospectionException e) {
DaoGenericImpl.LOG.error(e);
throw new HibernateException(e);
}
}
public T save(T entity) {
try {
Object newObject = null;
newObject = super.getHibernateTemplate().merge(entity);
return (T) newObject;
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
throw new HibernateException(ex);
}
}
protected List<T> findByCriteria(Criterion... criterion) {
try {
Criteria crit = this.createCriteria();
for (Criterion c : criterion) {
crit.add(c);
}
return crit.list();
} catch (final HibernateException ex) {
DaoGenericImpl.LOG.error(ex);
throw new HibernateException(ex);
}
}
protected T findUniqueEntityByQuery(String query, Object... parameter) {
List<T> list = super.getHibernateTemplate().find(query, parameter);
if (list.size() > 1) {
// /throw new NonUniqueObjectException("Non unique object", ID, persistentClass.getClass());
}
if (list.size() == 0) {
return null;
}
return (T) list.get(0);
}
public Criteria createCriteria() {
return super.getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(getPersistentClass());
}
public Query getNamedQuery(String name) {
return super.getHibernateTemplate().getSessionFactory().getCurrentSession().getNamedQuery(name);
}
public Query getQuery(String query) {
return super.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(query);
}
}
IDaoUser.java
package br.com.tratomais.core.dao;
import java.util.List;
import br.com.tratomais.core.model.Domain;
import br.com.tratomais.core.model.User;
public interface IDaoUser extends IDaoGeneric<User, Integer> {
public User findByLogin(String userName);
public User findByLogin(String userName, Domain domain);
public List<User> findByName(String name);
public List<User> listAllAdmin();
public List<User> listUserAllowed(List<Integer> listOfPartnersId, boolean isRoot) ;
public List<User> listUserPerPartner(int partnerId);
}
DaoUserImpl.java
package br.com.tratomais.core.dao.impl;
import java.util.LinkedList;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import br.com.tratomais.core.dao.IDaoUser;
import br.com.tratomais.core.model.Domain;
import br.com.tratomais.core.model.User;
import br.com.tratomais.core.model.UserPartner;
import br.com.tratomais.core.model.customer.Partner;
@SuppressWarnings("unchecked")
public final class DaoUserImpl extends DaoGenericImpl<User, Integer> implements IDaoUser {
private static final Logger logger = Logger.getLogger( DaoUserImpl.class );
public DaoUserImpl() {
super();
}
public User findByLogin(String userName) {
return super.findUniqueEntityByQuery("From User where login = ?", userName);
}
public List<User> findByName(String name) {
return super.findByCriteria(Restrictions.ilike("name", name, MatchMode.START));
}
public User findByLogin(String userName, Domain domain) {
Object[] object = { userName, domain };
return super.findUniqueEntityByQuery("From User where login = ? and domain = ?", object);
}
public List<User> listAllAdmin() {
return super.getHibernateTemplate().find("From User u where u.administrator = true");
}
public List<User> listUserAllowed(List<Integer> listOfPartnersId, boolean isRoot) {
StringBuilder hql = new StringBuilder();
hql.append("Select distinct u from User u, UserPartner up, Partner p ");
hql.append("where u.userId = up.id.userId ");
hql.append("and p.partnerId = up.id.partnerId ");
hql.append("and p.partnerId in (:listOfPartnersId) ");
if(isRoot == false){
hql.append("and u.administrator = false ");
}
Query query = super.getQuery(hql.toString());
query.setParameterList("listOfPartnersId", listOfPartnersId);
List<User> myList = query.list();
return myList;
}
@Override
public List<User> listUserPerPartner(int partnerId) {
Partner partner = (Partner) getSession().get(Partner.class, partnerId);
List<User> lista = new LinkedList<User>();
for(UserPartner up:partner.getUserPartners())
lista.add(up.getUser());
return lista;
}
}
Se estiver faltando algum me avisem que posto, obriga a todos desde já.
abs