I was using,
- Mojarra 2.3.0-m01
- OmniFaces 2.0.
- PrimeFaces 5.1 final
- PrimeFaces Extension 3.0.0
- GlassFish Server 4.1
And other Java EE artifacts.
Injection points in @FacesValidator
like as follows,
@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.
}
}
Those injection points remain null
(I did not explicitly try injecting an EJB but it should not happen as well like a managed bean).
Since the above-mentioned Mojarra version is still available as a snapshot, I tried downgrading it to 2.2.10 with the same version of OmniFaces which is 2.0 (alternatively also tried with OmniFaces 2.1-SNAPSHOT - on both Mojarra 2.2.10 and 2.3.0-m01 alternatively) but to no avail.
This worked, when I downgraded Majarra to 2.2.8-02 (tried with OmniFaces 1.8.1, 2.0 and 2.1-SNAPSHOT alternatively). I did not try other Mojarra versions.
Was the support to make @FacesValidator
and @FacesConverter
candidates for EJB and CDI injection points by means of OmniFaces (which in turn does not require any addition dependencies and/or configurations) removed for newer versions of Mojarra?
I have not yet explicitly tried in @FacesConverter
just because changing this many libraries alternatively so many times using a buggy NetBeans IDE which also goes very slow on Windows by nature took the whole day from dawn to dusk.
EDIT :
The server produces the following Weld related warnings.
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
. I downgraded it to 2.2.2 for Tomcat, but still can't reproduce it. Should try GF 4.1 later. Those warnings are unlikely related. – TownswomanInfo: WELD-000900: 2.2.2 (Final)
on the terminal. – Viscountcy@FacesConverter
. In other words, I'm still unable to reproduce your problem. – Townswoman@SessionScoped
and@ViewScoped
alternatively), a single@FacesValidator
where I have injected the CDI managed bean. The managed bean injection failed on Mojarra 2.2.10 but it succeeded on Mojarra 2.2.8-02 (alternatively). I have tried using OmniFaces 2.1 - SNAPSHOT. In a nutshell, I could see the exact same behaviour after creating a brand new blank JSF project having least possible dependencies and resources. – Viscountcy@FacesConverter
. The same thing happened - the injection point succeeded on Mojarra 2.2.8-02 but it remainednull
on Mojarra 2.2.10. It is a standard NetBeans project using Ant build script to deploy the application hereby, not using the Maven build tool but that should not be the cause. The library is available on the class-path anyway. The server also logs that information on the terminal -Info: Using OmniFaces version 2.1-SNAPSHOT
. – Viscountcy/WEB-INF/beans.xml
(it was already present in OmniFaces showcase). Then it worked again. Does it for you too? – Townswomanbeans.xml
(/WEB-INF/beans.xml
) withbean-discovery-mode="annotated"
but to no avail. The injection point remainednull
on Mojarra 2.2.10 as said above (deployed the application all over again from scratch carefully). – Viscountcybeans.xml
was just empty. And yes,annotated
makes the injected beannull
again. When I changed toall
(which is default btw), it works again. This is Weird. – Townswomanbean-discovery-mode
toall
made the injection point work on Mojarra 2.2.10. – Viscountcy