я использовал,
- Мохарра 2.3.0-m01
- ОмниФейс 2.0.
- Финал PrimeFaces 5.1
- Расширение PrimeFaces 3.0.0
- Сервер GlassFish 4.1
И другие артефакты Java EE.
Точки впрыска в @FacesValidator
выглядят следующим образом:
@FacesValidator(value="testValidator")
public class TestValidator implements Validator {
@Inject
private DemoEJB ejb;
@Inject
private ManagedBean managedBean;
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
// Use the injected EJB and/or managed bean here.
}
}
Эти точки внедрения остаются null
(я явно не пытался внедрить EJB, но это не должно происходить так же хорошо, как управляемый компонент).
Поскольку вышеупомянутая версия Mojarra все еще доступна в виде моментального снимка, я попытался понизить ее до 2.2.10 с той же версией OmniFaces, что и 2.0 (в качестве альтернативы также пробовал с OmniFaces 2.1-SNAPSHOT — как на Mojarra 2.2.10, так и на 2.3. 0-m01 альтернативно) но безрезультатно.
Это сработало, когда я понизил версию Majarra до версии 2.2.8-02 (поочередно пробовал использовать OmniFaces 1.8.1, 2.0 и 2.1-SNAPSHOT). Я не пробовал другие версии Mojarra.
Была ли удалена поддержка создания @FacesValidator
и @FacesConverter
кандидатов для точек внедрения EJB и CDI с помощью OmniFaces (что, в свою очередь, не требует дополнительных зависимостей и/или конфигураций) для более новых версий Mojarra?
Я еще не пробовал явно в @FacesConverter
только потому, что изменение такого количества библиотек попеременно так много раз с использованием ошибочной среды IDE NetBeans, которая по своей природе также очень медленно работает в Windows, заняло целый день от рассвета до заката.
РЕДАКТИРОВАТЬ :
Сервер выдает следующие предупреждения, связанные со сваркой.
WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.ApplicationProducer@b15a70 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.ApplicationMapProducer@db0450 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.ViewMapProducer@1c55365 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.ExternalContextProducer@14b1a6 declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.FacesContextProducer@1048acb declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation com.sun.faces.cdi.ViewProducer@275cfa declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
INFO: WELD-000900
. Я понизил его до 2.2.2 для Tomcat, но все еще не могу его воспроизвести. Стоит попробовать GF 4.1 позже. Эти предупреждения вряд ли связаны. - person BalusC   schedule 07.04.2015Info: WELD-000900: 2.2.2 (Final)
на терминале. - person Tiny   schedule 07.04.2015@FacesConverter
. Другими словами, я все еще не могу воспроизвести вашу проблему. - person BalusC   schedule 17.04.2015@SessionScoped
и@ViewScoped
), один@FacesValidator
, куда я ввел управляемый компонент CDI. Внедрение управляемого компонента не удалось в Mojarra 2.2.10, но удалось в Mojarra 2.2.8-02 (альтернативно). Я пробовал использовать OmniFaces 2.1 — SNAPSHOT. Короче говоря, я мог видеть точно такое же поведение после создания нового пустого проекта JSF с наименьшими возможными зависимостями и ресурсами. - person Tiny   schedule 17.04.2015@FacesConverter
. Произошло то же самое - точка инъекции удалась на Mojarra 2.2.8-02, но осталасьnull
на Mojarra 2.2.10. Это стандартный проект NetBeans, в котором для развертывания приложения используется сценарий сборки Ant, а не инструмент сборки Maven, но это не должно быть причиной. В любом случае библиотека доступна по пути к классам. Сервер также регистрирует эту информацию на терминале -Info: Using OmniFaces version 2.1-SNAPSHOT
. - person Tiny   schedule 17.04.2015/WEB-INF/beans.xml
(он уже присутствовал в витрине OmniFaces). Потом снова заработало. Это и для вас тоже? - person BalusC   schedule 17.04.2015beans.xml
(/WEB-INF/beans.xml
) с помощьюbean-discovery-mode="annotated"
, но безрезультатно. Точка внедрения осталасьnull
на Mojarra 2.2.10, как сказано выше (аккуратно развернул приложение с нуля). - person Tiny   schedule 17.04.2015beans.xml
был просто пуст. И да,annotated
снова делает внедренный компонентnull
. Когда я изменил наall
(кстати, по умолчанию), он снова работает. Это странно. - person BalusC   schedule 17.04.2015bean-discovery-mode
наall
, точка внедрения заработала на Mojarra 2.2.10. - person Tiny   schedule 17.04.2015