[RESOLVIDO] Vraptor - erro na criação dos controller

Seguindo o exemplo contido no livro Vraptor da Casa do Código obtive o seguinte erro:

[code]Jul 07, 2013 4:51:28 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Unhandled exception occurred whilst decorating page
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘livrosController’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.modelo.Estante]: : Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:263)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.instanceFor(SpringBasedContainer.java:86)
at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:46)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:83)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:69)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.EnhancedRequestExecution.execute(EnhancedRequestExecution.java:44)
at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:91)
at br.com.caelum.vraptor.ioc.spring.SpringProvider.provideForRequest(SpringProvider.java:58)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 45 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 59 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 73 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:263)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.instanceFor(SpringBasedContainer.java:86)
at br.com.caelum.vraptor.ioc.spring.ComponentFactoryBean.getObject(ComponentFactoryBean.java:43)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
… 82 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:796)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 96 more

Jul 07, 2013 4:51:28 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/livraria-admin] threw exception
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘livrosController’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.modelo.Estante]: : Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:263)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.instanceFor(SpringBasedContainer.java:86)
at br.com.caelum.vraptor.interceptor.InstantiateInterceptor.intercept(InstantiateInterceptor.java:46)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:83)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.interceptor.ResourceLookupInterceptor.intercept(ResourceLookupInterceptor.java:69)
at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:54)
at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:54)
at br.com.caelum.vraptor.core.EnhancedRequestExecution.execute(EnhancedRequestExecution.java:44)
at br.com.caelum.vraptor.VRaptor$1.insideRequest(VRaptor.java:91)
at br.com.caelum.vraptor.ioc.spring.SpringProvider.provideForRequest(SpringProvider.java:58)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘estanteNoBancoDeDados’: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.gfkauer.livraria.persistencia.LivroDAO]: : Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 45 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘JPALivroDAO’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManager]: : Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 59 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘br.com.gfkauer.livraria.persistencia.FabricaDeEntityManager’: FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:109)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1429)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:844)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:786)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 73 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fabricaDeEntityManager’: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.persistence.EntityManagerFactory]: : No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:730)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
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$2.getObject(AbstractBeanFactory.java:329)
at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:263)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at br.com.caelum.vraptor.ioc.spring.SpringBasedContainer.instanceFor(SpringBasedContainer.java:86)
at br.com.caelum.vraptor.ioc.spring.ComponentFactoryBean.getObject(ComponentFactoryBean.java:43)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
… 82 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single matching bean but found 2: [br.com.gfkauer.livraria.persistencia.FabricaDeEntityManagerFactory, br.com.caelum.vraptor.util.jpa.EntityManagerFactoryCreator]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:796)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:795)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:723)
… 96 more
[/code]

Efetuei pesquisas e ainda assim não localizei o motivo do erro…
Tentei baixar o código fonte do git do autor do livro, e este também não funcionou. Devo mencionar que a unica diferença entre a implementação citada no livro e a minha é o nome do pacote…

Caso alguem tenha alguma idéia do motivo do erro fico grato.

É porque vc configurou o VRaptor pra usar JPA e criou uma classe pra criar as EntityManagers, logo na hora de injetar um entityManager, ele encontra dois e não sabe o que fazer.

Tem que tirar um deles

Quer dizer que se eu quiser que o projeto use meu entitymanager eu devo retirar a configuração do vraptor usar o jpa? Entendi correto?

Não

No seu caso, vc criou uma classe que cria os entity managers e configurou o vraptor para usar a dele.

Logo o projeto tem duas classes que criam entity managers.

Vc deve retirar uma delas.

No exemplo que você está seguindo, o autor deve ter exemplificado a criação de uma classe que cria o entity manager. Essa está conflitando com a do VRaptor que você configurou

gfkauer

Vc precisa remover o pacote da JPA do web.xml mesmo, para seguir com as component factories do livro. Se quiser não fazer essas factories, sem problemas, pode usar a do pacote da JPA que já fazem tudo o que o livro explica.

[quote=Lucas Cavalcanti]gfkauer

Vc precisa remover o pacote da JPA do web.xml mesmo, para seguir com as component factories do livro. Se quiser não fazer essas factories, sem problemas, pode usar a do pacote da JPA que já fazem tudo o que o livro explica.[/quote]

Cara Valeu mesmo heim… essa sua dica me ajudou muito, sou iniciante no vraptor e estou seguindo o livro de Lucas tambem e me deparei com essa confusão de entitymanager duplicado sabia que teria q tirar uma mais nao sabia qual e realmente eu tirei as anotacoes @components da minha classe que implementaca ComponentFactory e resolveu de boa… obrigado mesmo.