cdi does not find daos (spring data + ejb + cdi)

0

The situation is as follows, I'm using the spring boot and the first thing I did was disable the cat tone and use wildfly (10)

I used spring data to create Daos

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

Then I decided to do an integration with ejb + cdi, then the problems began the cdi can not find these Daos.

@Stateless public class AutorBusiness {

@Inject
private AutoresDao autoresDao;

and finally use the resource

@RestController

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

@Inject
private AutorBusiness autorBusiness;

wildfly finds and registers both the author Business and the good business book

Buthegivesthaterroraki

20:31:04,602ERROR[org.jboss.msc.service.fail](MSCservicethread1-1)MSC000001:Failedtostartservicejboss.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 (AuthorBusiness.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 Comment with qualifiers @Default   at injection point [BackedAnnotatedField] @Inject private com.restApi.business.LivroBusiness.comentBd   at com.restApi.business.LivroBusiness.comentBd (BookBusiness.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 (AuthorBusiness.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 Comment with qualifiers @Default   at injection point [BackedAnnotatedField] @Inject private com.restApi.business.LivroBusiness.comentBd   at com.restApi.business.LivroBusiness.comentBd (BookBusiness.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 }

It follows tb my application.properties , I created a Data Source in standalone.xml of wildfly, it is funfando

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

and finally follow the

If someone has the solution of this I graze the bottom of my S2

    
asked by anonymous 27.01.2017 / 01:09

1 answer

0

The Comment dependency of the BusinessBusiness class is not eligible for the CDI.

To make it eligible you can include the beans.xml file in your project, WEB-INF (war) or META-INF (jar) folder, but this makes all classes in your project eligible and controllable by the container.

Another option is to include a CDI scope in the classes you want to make them eligible, in your case.

The possible scopes are:

  • ApplicationScoped - The state of the bean remains during the life of the application.
  • SessionScoped - The Bean lifecycle is bound to the session of the user.
  • RequestScoped - A new Bean will be created for each request.
  • Dependent - Depends on whoever injects the Bean.
  • ConversationScoped - Allows the Bean to cycle through a RequestScoped lifetime and a SessionScoped programmatically.
  • By itself a DAO I indicate the Dependent scope.

        
    13.04.2017 / 18:31