-
Bug
-
Resolution: Done
-
Major
-
21.0.0.Final
-
None
-
-
Undefined
-
---
-
---
The JSF spec 2.3 explicitly states in chapter 5.9.1 - JSF Objects Valid for @Inject Injection that:
It must be possible to use @Inject when specifying the following kinds of JSF managed objects.
- Validators declared with @javax.faces.validator.FacesValidator(managed=”true”)
- Converters declared with @javax.faces.convert.FacesConverter(managed=”true”)
- FacesBehaviors declared with @javax.faces.component.behavior.FacesBehavior(managed=”true”)
The idea in javaee8 is that now a Converter (for example) can be annotated this way:
@FacesConverter(value = "urlConverter", managed = true) public class URLConverter implements Converter {
And it can be injected in a bean for example:
@Named(value="urlConverterBean") @RequestScoped public class UrlConverterBean { @Inject @FacesConverter(value = "urlConverter", managed = true) private URLConverter urlConverter;
In the current wildfly this throws the following exception at deploy time:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."inject-converter.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."inject-converter.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "inject-converter.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739) at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701) at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363) at java.lang.Thread.run(Thread.java:748) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0009: Annotation FACES_CONVERTER in class com.sample.jsf.URLConverter com.sample.jsf.UrlConverterBean.injectConverter3 is only allowed on classes at org.jboss.as.jsf.deployment.JSFAnnotationProcessor.deploy(JSFAnnotationProcessor.java:122) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182) ... 8 more
Besides in the mojarra test-suite there is a cdi sample application that cannot be deployed in wildfly because of this issue.