Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to inject FacesContext against GlassFish 5 (JSF 2.3, CDI 2.0) #22094

Closed
glassfishrobot opened this issue Jul 23, 2017 · 16 comments
Closed
Milestone

Comments

@glassfishrobot
Copy link

Environment Details


Problem Description

Per Arjan Tijms and Josh Juneau, as of JSF 2.3, Faces context can now be injected via the @Inject annotation.

Attempted to write a simple proof of concept example illustrating this feature, FacesContext was not successfully injected.

Here is the complete stacktrace in the GlassFish logs when attempting to deploy the code:

Info: visiting unvisited references
Info: visiting unvisited references
Info: visiting unvisited references
Info: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Info: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Info: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorMandatory is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNever is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNotSupported is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequired is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequiresNew is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorSupports is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!
Severe: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:239)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:460)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:504)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:481)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:230)
... 41 more

Severe: Exception while loading the app
Severe: Undeployment failed for context /jsfarbitrarymess
Severe: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:504)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:481)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:230)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:460)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:745)

Info: visiting unvisited references
Info: visiting unvisited references
Info: visiting unvisited references
Info: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Info: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
Info: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@observes ProcessAnnotatedType, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class com.sun.faces.flow.FlowDiscoveryCDIHelper is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorMandatory is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNever is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorNotSupported is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequired is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorRequiresNew is deprecated from CDI 1.1!
WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class org.glassfish.cdi.transaction.TransactionalInterceptorSupports is deprecated from CDI 1.1! WARN: WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType) used for class com.ibm.jbatch.container.cdi.BatchProducerBean is deprecated from CDI 1.1!
Severe: Exception during lifecycle processing
org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:239)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:460)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:504)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:481)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:230)
... 41 more

Severe: Exception while loading the app
Severe: Undeployment failed for context /jsfarbitrarymess
Severe: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type FacesContext with qualifiers @default
at injection point [BackedAnnotatedField] @Inject net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext
at net.ensode.javaee8book.jsfarbitrarymess.ArbitraryMessageController.facesContext(ArbitraryMessageController.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:504)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:481)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:230)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:496)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:535)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:460)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:745)

Expected Behavior: FacesContext is injected successfully.

Steps to reproduce

Deploy a Maven web project in which one of the CDI managed beans attempts to inject FacesContext, use the following dependencies in pom.xml:

<dependencies>
        <dependency>
            <groupId>javax.faces</groupId>
            <artifactId>javax.faces-api</artifactId>
            <version>2.3-pfd</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Impact of Issue

Unable to inject FacesContext in to a RequestScoped CDI managed beans

Sample project demonstrating the issue: https://github.com/dheffelfinger/Java-EE-8-Application-Development-Code-Samples/tree/master/ch02_src/jsfarbitrarymess

@glassfishrobot
Copy link
Author

@arjantijms Commented
@dheffelfinger

It looks you didn't activate JSF 2.3. By default JSF 2.3 is in a kind of pseudo JSF 2.2 mode. To tell it to become "JSF 2.3" you need to configure that via an annotation.

See one of the tests in the RI for that:

https://github.com/javaserverfaces/mojarra/blob/master/test/javaee8/ajax/src/main/java/com/sun/faces/test/javaee8/ajax/ConfigurationBean.java

@glassfishrobot
Copy link
Author

@dheffelfinger Commented
Thanks @arjantijms , I'll give it a shot as soon as I get a chance. Will this be necessary once GlassFish 5 is officially released?

@glassfishrobot
Copy link
Author

@arjantijms Commented
@dheffelfinger

Yes, it's a "feature" of JSF, and is independent of any integration with an application server.

@glassfishrobot
Copy link
Author

@dheffelfinger Commented
I see, seems kind of odd to have to specify "I'm using JSF 2.3" when deploying against an app server including an implementation of JSF 2.3.

By the way, your write up at http://arjan-tijms.omnifaces.org/p/jsf-23.html is super informative, thanks for taking the time to write it.

@glassfishrobot
Copy link
Author

@arjantijms Commented

I see, seems kind of odd to have to specify "I'm using JSF 2.3" when deploying against an app server including an implementation of JSF 2.3.

That's a little bit odd indeed and the EG at the time was of the same opinion, but eventually the spec lead(s) made this choice. It's related to background compatibility.

By the way, your write up at http://arjan-tijms.omnifaces.org/p/jsf-23.html is super informative, thanks for taking the time to write it.

Great that you appreciate it ;)

@glassfishrobot
Copy link
Author

@dheffelfinger Commented
As @arjantijms correctly pointed out, I was missing a class annotated with @FacesConfig. I was also missing a beans.xml deployment descriptor, as pointed out by @manfredriem.

@glassfishrobot
Copy link
Author

@dheffelfinger Commented
Good to know @manorrock @manfredriem

On Mon, Jul 24, 2017 at 5:51 PM, manfredriem notifications@github.com
wrote:

You could also have added a faces-config.xml file with version set to 2.3


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/javaee/glassfish/issues/22094#issuecomment-317565666,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AM2654US8seGG6motvweluyLmuKkoowJks5sRRHtgaJpZM4Ogf7Q
.

--
http://ensode.net - A Guide to Java, Linux and Other Technology Topics
My Books: http://www.packtpub.com/authors/profiles/david-heffelfinger
My Video Training:
http://www.packtpub.com/java-ee-development-with-netbeans-7/video
Follow me on Twitter: https://twitter.com/ensode

@glassfishrobot
Copy link
Author

@arjantijms Commented
@dheffelfinger note that faces-config.xml with 2.3 version does not work. This was one of the initial ways to switch JSF into 2.3 mode, but this was abandoned later in the cycle.

@glassfishrobot
Copy link
Author

@hantsy Commented
This confused me for a few days, personally I think it is a bad idea when I am using a JSF 2.3 compatible container, such as GFv5, and I still have to enable it manually.

@glassfishrobot
Copy link
Author

@hantsy Commented
I have added a ConfigurationBean(copied https://github.com/javaserverfaces/mojarra/blob/master/test/javaee8/ajax/src/main/java/com/sun/faces/test/javaee8/ajax/ConfigurationBean.java) in my project, and tried to fix my issues: https://github.com/javaserverfaces/mojarra/issues/4264, but it still does not work.

@glassfishrobot
Copy link
Author

@Andrew-gr Commented
@hantsy the same was for me after trying to add ConfigurationBean to GF5, Payara 5, or GF412 (with manually upgraded JSF to v 2.3.2)
@arjantijms can you please add little bit more explanation to the statement "note that faces-config.xml with 2.3 version does not work": currently it seems that I am not able to activate JSF 2.3 at all... Thank you!

@glassfishrobot
Copy link
Author

@ConstantinAlin Commented
@Andrew-gr It means that an empty faces-config.xml file, with version=2.3, is not involved into enabling CDI injection and EL resolution using CDI.

By default, JSF 2.3 runs in a compatibility mode with previous releases of JSF, unless a CDI managed bean is included in the application with the annotation @javax.faces.annotation.FacesConfig. To switch into a JSF 2.3 mode you will need a configuration bean like below:

import javax.faces.annotation.FacesConfig;

/**
 * The presence of the @FacesConfig annotation on a managed bean deployed within an application enables version specific
 * features. In this case, it enables JSF CDI injection and EL resolution using CDI.
 *
 */
@FacesConfig(version = FacesConfig.Version.JSF_2_3)
public class ConfigurationBean {
}

Related to this: https://github.com/javaserverfaces/mojarra/issues/4270
Sample JSF 2.3 demos: https://github.com/ConstantinAlin/Quickstart-JSF2.3-Samples

@glassfishrobot
Copy link
Author

@Andrew-gr Commented
@ConstantinAlin thanks for reply, found your repo with "Sample JSF 2.3 demos" and project from your repo worked fine on Payara 5. Will now investigate the differences between projects in order to locate root cause. Thank you!

@glassfishrobot
Copy link
Author

@arjantijms Commented
Hi,

First of all thank you all for updating this issue with comments. I agree that the current situation is a tad confusing.

There's a couple of things going on here though:

  1. Initially we experimented with a couple of ways to switch JSF 2.3 in JSF 2.3 mode. The 2.3 faces-config was explored, as well as a context-parameter in web.xml. Eventually we settled on an annotation. Very likely I forgot to remove the 2.3 faces-config switch at at least one place. This is my mistake then and I apologise for that.
  2. The fact that JSF needs to be switched into the "current version" was highly controversial. Pretty much the entire EG voted against that, but eventually we could not get around the backwards compatibility requirements that the JCP sets for Java EE and the spec lead enforces.
  3. The FacesConfig annotation serves another purpose; in Java EE JSF was never automatically activated like JSP is. It always needs an explicit web.xml Servlet mapping, a class with a JSF annotation or an (empty) faces-config.xml file. As we pretty much deprecated the most frequently used JSF annotations in application code (@ManagedBean etc), @FacesConfig now functions as that "activating annotation".

For Payara 5 I'd like to see if we can put it into JSF 2.3 mode by default, but even then you'd still need something to activate/map JSF, and @FacesConfig might still be the most convenient way then.

Going forward in Java EE and possibly hooking into the config JSR, it may be an option to have a more universal config to activate/de-active Java EE components (i.e. having similar config to activate JAX-RS and JSF and to de-activate CDI).

@glassfishrobot glassfishrobot added this to the 5.0 milestone Sep 17, 2018
@glassfishrobot
Copy link
Author

@pavelpetrovic
Copy link

pavelpetrovic commented Apr 19, 2021

Hello. I am in Netbeans 12, GlassFish 5.0.1. I am trying to create a very simple JSF application for EE8. It does not work. I add beans.xml file using the wizzard (it contains beans_1_1.xsd, but changing it to beans_2_0.xsd makes no difference)
(without this file it does not even deploy!), but even adding the code ConfigurationBean either into default package or some other package does not help, EL expressions are still not interpreted. Any ideas, please?
https://kempelen.dai.fmph.uniba.sk/WebApplication2.zip
BTW. the maven demos for JSF2.3 from https://github.com/ConstantinAlin/Quickstart-JSF2.3-Samples
open in Netbeans and work, except that the first line contains the "" tag, which should not be there. However, they are targeted to EE7, not to EE8.
An ant wizzard-created EE7 web application (that is also using JSF2.3) works too, even without beans.xml file.
But the ant wizzard created EE8 with JSF2.3 works not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants