у меня есть это (печально известный сейчас) @SessionScoped боб в моем JSF проекта:WELD-001408: Невыполненные зависимости для типа HttpSession
@Named(value = "appointmentFormBean")
@SessionScoped
public class AppointmentFormBean implements Serializable {
@Inject
private transient AppointmentService service;
public AppointmentFormBean() {
bookedAlready = new ArrayList<>();
types = new LinkedHashMap<>(4, (float) 0.75);
}
public AppointmentService getService() {
return service;
}
public void setService(AppointmentService service) {
this.service = service;
}
...
//other fields, setters and getters
}
У меня есть следующие интерфейсы, которые я использую для EJBs:
@Local
public interface AppointmentRepository {/**methods*/}
@Local
public interface AppointmentService {/**methods*/}
И вот EJBs (кратко):
@Singleton
@InMemoryRepository
public class InMemoryAppointmentRepository implements AppointmentRepository {/**code*/}
@Stateless
@Default
public class DefaultAppointmentService implements AppointmentService {
private AppointmentRepository repository;
@Inject
public DefaultAppointmentService(@InMemoryRepository AppointmentRepository repository) {
this.repository = repository;
}
...}
Во время сборки (которая в противном случае успешной) я получаю Это сваривает предупреждение:
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.jglue.cdiunit.in...receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
В процессе работы я получаю это исключение:
Severe: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type HttpSession with qualifiers @CdiUnitServlet
at injection point [BackedAnnotatedField] @Inject @CdiUnitServlet private org.jglue.cdiunit.ContextController.session
at org.jglue.cdiunit.ContextController.session(ContextController.java:0)
WELD-001475: The following beans match by type, but none have matching qualifiers:
- WELD%AbstractSyntheticBean%WEB-INF/lib/cdi-unit-3.1.3%HttpSession
Я могу напечатать весь стек, если вы хотите. Просмотр stackoverflow и Интернета я нашел много теорий о том, что может стать неправильным, но не применимым решением. Были предположения, что ошибка может быть связана с интеграцией Glassfish с интеграцией Weld, Glassfish с Java SE 8 до 20 (я использую jdk-8u65-linux-x64.rpm), но потом я увидел людей, имеющих схожие проблемы с их проектами на WildFly.
Поэтому я призываю вас, чтобы спасти :-)
п.с. Мой проект доступен здесь: https://github.com/vasigorc/rimmaproject