1. java
  2. android
  3. c#
  4. .net
  5. javascript
  6. php
  7. jquery
  8. html
  9. sql

Erro ao injetar EntityManager com o Vraptor 4

Na verdade é mais uma duvida. fiz um login DAO, que injeta o EntityManager. Se user

@Inject EntityManager entityManager

, apresenta o erro:

15:21:09,160 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-12) MSC000001: Failed to start service jboss.deployment.unit."ultraweb.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."ultraweb.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_40]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_40]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private br.com.ultraworks.ultraweb.dao.LoginDao.entityManager
  at br.com.ultraworks.ultraweb.dao.LoginDao.entityManager(LoginDao.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)
    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(Unknown Source) [rt.jar:1.7.0_40]
    ... 3 more

15:21:09,167 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "ultraweb.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"ultraweb.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ultraweb.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private br.com.ultraworks.ultraweb.dao.LoginDao.entityManager
  at br.com.ultraworks.ultraweb.dao.LoginDao.entityManager(LoginDao.java:0)
"}}
15:21:09,553 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "ultraweb.war" (runtime-name : "ultraweb.war")
15:21:09,555 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."ultraweb.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."ultraweb.war".WeldStartService: Failed to start service

Se fizer:

@PersistenceContext EntityManager entityManager;

O erro não ocorre:

  1. Porque ocorre este erro?
  2. qual a diferença entre um e outro?

Estou usando vraptor 4, vraptor-jpa

  1. Você vai ver essas setas em qualquer página de pergunta. Com elas, você pode dizer se uma pergunta ou uma resposta foram relevantes ou não.
  2. Edite sua pergunta ou resposta caso queira alterar ou adicionar detalhes.
  3. Caso haja alguma dúvida sobre a pergunta, adicione um comentário. O espaço de respostas deve ser utilizado apenas para responder a pergunta.
  4. Se o autor da pergunta marcar uma resposta como solucionada, esta marca aparecerá.
  5. Clique aqui para mais detalhes sobre o funcionamento do GUJ!

1 resposta

Não é a resposta que estava procurando? Procure outras perguntas com as tags vraptor jpa ou faça a sua própria pergunta.