Não estou conseguindo subir a minha aplicação, pois sempre tenho esse erro.
Meu log atualmente:
` GRAVE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener org.jboss.weld.exceptions.DeploymentException: Exception List with 3 exceptions: Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type EntityManager with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public br.com.caelum.vraptor.jpa.JPATransactionInterceptor(EntityManager, Validator, MutableResponse) at br.com.caelum.vraptor.jpa.JPATransactionInterceptor.<init>(JPATransactionInterceptor.java:0) Possible dependencies: - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.caelum.vraptor.jpa.EntityManagerCreator.getEntityManager()], - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.marvin.reserva.produces.EntityManagerProduces.getEntityManager()]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:376) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type EntityManager with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public br.com.marvin.reserva.dao.ProfessorDao(EntityManager) at br.com.marvin.reserva.dao.ProfessorDao.<init>(ProfessorDao.java:0) Possible dependencies: - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.caelum.vraptor.jpa.EntityManagerCreator.getEntityManager()], - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.marvin.reserva.produces.EntityManagerProduces.getEntityManager()]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:376) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type EntityManager with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public br.com.caelum.vraptor.jpa.extra.ParameterLoader(EntityManager, HttpServletRequest, ParameterNameProvider, Result, Converters, FlashScope) at br.com.caelum.vraptor.jpa.extra.ParameterLoader.<init>(ParameterLoader.java:0) Possible dependencies: - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.caelum.vraptor.jpa.EntityManagerCreator.getEntityManager()], - Producer Method [EntityManager] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped public br.com.marvin.reserva.produces.EntityManagerProduces.getEntityManager()]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:376) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68) at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60) at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:76) at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:475) at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:392) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:85) at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:170) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4842) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
set 24, 2016 5:52:32 PM org.apache.catalina.core.StandardContext startInternal GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file set 24, 2016 5:52:32 PM org.apache.catalina.core.StandardContext startInternal GRAVE: Context [/reserva] startup failed due to previous errors set 24, 2016 5:52:32 PM org.apache.catalina.core.StandardContext listenerStop GRAVE: Exception sending context destroyed event to listener instance of class org.jboss.weld.environment.servlet.Listener java.lang.NullPointerException at org.jboss.weld.servlet.WeldInitialListener.contextDestroyed(WeldInitialListener.java:120) at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.contextDestroyed(ForwardingServletListener.java:30) at org.jboss.weld.environment.servlet.Listener.contextDestroyed(Listener.java:85) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4889) at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5526) at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)`
E aqui meu Produtor:
`package br.com.marvin.reserva.produces;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class EntityManagerProduces {
private EntityManagerFactory managerFactory = Persistence.createEntityManagerFactory("reserva_materiais");
@Produces
@RequestScoped
public EntityManager getEntityManager() {
return managerFactory.createEntityManager();
}
public void close(@Disposes EntityManager em) {
em.close();
}
}
`
pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>br.com.marvin</groupId> <artifactId>reserva</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <properties> <maven.compiler.source>1.8</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>3.0.2.Final</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <version>1.1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core-impl</artifactId> <version>2.1.2.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.jboss.weld.servlet</groupId> <artifactId>weld-servlet</artifactId> <version>2.1.2.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>br.com.caelum</groupId> <artifactId>vraptor</artifactId> <version>4.1.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>javax.inject</groupId> <artifactId>javax.inject</artifactId> <version>1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator-cdi</artifactId> <version>5.1.1.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.1.0.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>15.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>br.com.caelum.vraptor</groupId> <artifactId>vraptor-jpa</artifactId> <version>4.0.3</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>4.3.0.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.0.Final</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.1-api</artifactId> <version>1.0.0.Final</version> <scope>compile</scope> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> </project>
Alguém poderia me ajudar?