0

a situação é a seguinte , eu estou usando o spring boot e a primeira coisa que fiz foi desabilitar o tom cat e usar o wildfly(10)

usei o spring data, para criar os Daos

public interface AutoresDao extends JpaRepository<Autor, Long >{}

ai eu decidi fazer uma integração com ejb + cdi, ai começou os problemas o cdi não consegue encontrar esses Daos.

@Stateless public class AutorBusiness {

@Inject
private AutoresDao autoresDao;

e por fim uso no resource

@RestController

@RequestMapping("/autores") public class AutoresResources {

@Inject
private AutorBusiness autorBusiness;

o wildfly encontra e e registra tanto o autorBusiness como o livroBusiness de boa

inserir a descrição da imagem aqui

mas ai ele da esse erro aki

20:31:04,602 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."SpringBootBasic.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."SpringBootBasic.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
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)

Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 2 exceptions: Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type AutoresDao with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private com.restApi.business.AutorBusiness.autoresDao at com.restApi.business.AutorBusiness.autoresDao(AutorBusiness.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
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:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
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.threads.JBossThread.run(JBossThread.java:320)

Exception 1 : org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ComentDao with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private com.restApi.business.LivroBusiness.comentBd at com.restApi.business.LivroBusiness.comentBd(LivroBusiness.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
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:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
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.threads.JBossThread.run(JBossThread.java:320)

at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:76)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:445)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:96)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more

20:31:04,619 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "SpringBootBasic.war")]) - failure description: { "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"SpringBootBasic.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"SpringBootBasic.war\".WeldStartService: Failed to start service Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 2 exceptions: Exception 0 : org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type AutoresDao with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private com.restApi.business.AutorBusiness.autoresDao at com.restApi.business.AutorBusiness.autoresDao(AutorBusiness.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
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:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
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.threads.JBossThread.run(JBossThread.java:320)

Exception 1 : org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ComentDao with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private com.restApi.business.LivroBusiness.comentBd at com.restApi.business.LivroBusiness.comentBd(LivroBusiness.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
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:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
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.threads.JBossThread.run(JBossThread.java:320)

"}, "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"SpringBootBasic.war\".WeldStartService"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }

segue tb o meuapplication.properties, eu criei um Data Source no standalone.xml do wildfly, está funfando

spring.datasource.jndi-name = java:jboss/datasources/restDS

e por fim segue o diretório

inserir a descrição da imagem aqui

se alguem tiver a solução disso eu agrdeço do fundo do meu S2

1 Resposta 1

0

A dependência ComentDao da classe LivroBusiness não está elegível ao CDI.

Para torna-la elegível você pode incluir o arquivo beans.xml no seu projeto, pasta WEB-INF(war) ou META-INF(jar), mas isto torna todos as classes do seu projeto elegíveis e controláveis pelo container.

Outra opção é incluir um escopo do CDI nas classes que você deseja torna-las elegíveis, ComentDao no seu caso..

Os possíveis escopos são:

  1. ApplicationScoped - O estado do bean permanece durante o ciclo de vida da aplicação.
  2. SessionScoped - O ciclo de vida do Bean é vinculado a sessão do usuário.
  3. RequestScoped - Será criado um novo Bean a cada requisição.
  4. Dependent - Depende de escopo de quem injeta o Bean.
  5. ConversationScoped - Permite que o Bean transite entre um ciclo de vida RequestScoped e um SessionScoped de forma programática.

Por se um DAO eu indico o escopo Dependent.

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .