I working with jee and wildfly for few days now i have problem. I created something like this:
@Stateless
public class BookService {
@EJB
private BookDao bookDao;
public void addBook(Book book) {
bookDao.saveBook(book);
}
public Optional<Book> getBookById(Long id) {
return bookDao.getBookById(id);
}
public void updateBook(Book book) {
bookDao.updateBook(book);
}
@Produces
@Named("books")
public List<Book> getAllBooks() {
return bookDao.getAllBooks();
}
}
Next I tryied to use #{books}
in jsf but i got exception:
2017-05-23 08:49:07,447] Artifact ear:ear: Error during artifact deployment. See server log for details.
[2017-05-23 08:49:07,448] Artifact ear:ear: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"Lab6.ear\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Lab6.ear\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name books resolves to beans:
Producer Method [List] with qualifiers [@Default @Named @Any] declared as [[BackedAnnotatedMethod] @Produces @Named public app.service.BookService.getAllBooks()],
Producer Method [List] with qualifiers [@Default @Named @Any] declared as [[BackedAnnotatedMethod] @Produces @Named public app.service.BookService.getAllBooks()]"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"Lab6.ear\".WeldStartService"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
What is the source of problem.
BookService
is on one place in your deployment only. – Siliarus