我和jee和wildfly一起工作了几天,现在我有问题了。我创造了这样的东西:
@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();
}
}
接下来我试图在jsf中使用#{books}
,但我得到了例外:
2017-05-23 08:49:07,447]神器耳:耳:神器中出错 部署。有关详细信息,请参阅服务器日志。
[2017-05-23 08:49:07,448]神器耳:ear:java.lang.Exception: {&#34; WFLYCTL0080:服务失败&#34; =&GT; {&#34; jboss.deployment.unit \&#34; Lab6.ear \&#34; .WeldStartService&#34; =&GT; &#34;服务中的org.jboss.msc.service.StartException jboss.deployment.unit。\&#34; Lab6.ear \&#34; .WeldStartService:无法启动 服务
引起:org.jboss.weld.exceptions.DeploymentException:WELD-001414:Bean名称不明确。名册解析为bean:
生产者方法[List],带有限定符[@Default @Named @Any]声明为[[BackedAnnotatedMethod] @Produces @Named public app.service.BookService.getAllBooks()],
生产者方法[List],带有限定符[@Default @Named @Any]声明为[[BackedAnnotatedMethod] @Produces @Named public app.service.BookService.getAllBooks()]&#34;},&#34; WFLYCTL0412:必填 未安装的服务:&#34; =&GT; [&#34; jboss.deployment.unit \&#34; Lab6.ear \&#34; .WeldStartService&#34],&#34; WFLYCTL0180: 缺少/不可用依赖项的服务&#34; =&GT;未定义}
问题的根源是什么。