I have Faces-Config.xml set to web-facesconfig_2_3.xsd. Got the latest jars for JSF 2.3. Using CDI annotations for JSF and Spring, created two beans with request scope and tries to inject managed property from another bean paymentBean.
Followed this link.
import javax.inject.Inject;
import javax.inject.Named;
import javax.faces.annotation.ManagedProperty;
#Named("myBean")
#RequestScoped
public class MyBean implements Serializable {
#Inject #ManagedProperty("#{paymentBean.amount}")
private BigDecimal amount;
}
#Named(value = "paymentBean")
#RequestScoped
public class paymentBean implements Serializable {
private BigDecimal amount;
}
It throws following exception:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:592)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1466)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1097)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1059)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:589)
... 25 more
15:03:12,496 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 81) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./VTOL: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./VTOL: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:231)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:592)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:551)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:198)
... 8 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.amount})}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1466)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1097)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1059)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:589)
... 25 more
15:03:12,506 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "VTOL.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./VTOL" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./VTOL: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.payment.amount})}
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.amount})}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.amount})}"}}
15:03:12,536 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "VTOL.war" (runtime-name : "VTOL.war")
15:03:12,536 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.undertow.deployment.default-server.default-host./VTOL: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./VTOL: java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyBean': Unsatisfied dependency expressed through field 'amount'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.math.BigDecimal' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {#javax.inject.Inject(), #javax.faces.annotation.ManagedProperty(value=#{paymentBean.amount})}
Under payara I found that faces config with
<faces-config version="2.3"
does not work,
I used
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
</faces-config>
And all problems solved.
Try this
https://github.com/armdev/jsf-rulebook/blob/master/web-flow/src/main/webapp/WEB-INF/faces-config.xml
The first try run project without Spring, if all ok, integrate your preferred frameworks.
Related
My project was working fine yesterday. The only thing I did was to change the structure from a single war to a multi module pom. If I understand correctly the stacktrace there is ambiguousity between weld and omnifaces websocket lib. However there doesn't seem to be any call to any of my methods on the stacktrace. So maybe it's a problem with omnifaces ? I don't even use omnifaces websockets, I use javax.websocket. I did however try it out in this project in the past, and I did a search on "org.omnifaces.cdi" and commented out things from sub packages like #Param but the problem remains.
Also I don't understand why the ambiguousity seem to be from the 2 exact same classes:
Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default],
Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
[2016-06-25 03:13:59,430] Artifact core:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService: Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions
at org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions(SocketPushContextProducer.java:0)
Possible dependencies:
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default],
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject private org.omnifaces.cdi.push.SocketChannelManager.socketSessions
at org.omnifaces.cdi.push.SocketChannelManager.socketSessions(SocketChannelManager.java:0)
Possible dependencies:
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default],
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketUserManager with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject private org.omnifaces.cdi.push.SocketSessionManager.socketUsers
at org.omnifaces.cdi.push.SocketSessionManager.socketUsers(SocketSessionManager.java:0)
Possible dependencies:
- Managed Bean [class org.omnifaces.cdi.push.SocketUserManager] with qualifiers [#Any #Default],
- Managed Bean [class org.omnifaces.cdi.push.SocketUserManager] with qualifiers [#Any #Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:367)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Exception 0 :
org.jboss.weld.exceptions.AmbiguousResolutionException: WELD-001318: Cannot resolve an ambiguous dependency between:
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default],
- Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
at org.jboss.weld.manager.BeanManagerImpl.resolve(BeanManagerImpl.java:1235)
at org.jboss.weld.bootstrap.Validator.validatePseudoScopedInjectionPoint(Validator.java:926)
at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:902)
at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:917)
at org.jboss.weld.bootstrap.Validator.validatePseudoScopedBean(Validator.java:879)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:138)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:155)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
"}}
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions
Basically, Weld discovered multiple CDI managed beans which could be injected in private SocketSessionManager socketSessions field of the SocketPushContextProducer class. They are listed thereafter:
Possible dependencies:
Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [#Any #Default]
In this specific case they are however exactly the same. This means that there are multiple SocketSessionManager classes in the runtime classpath. This in turn means that there are multiple OmniFaces libraries/dependencies present in the runtime classpath (or a dirty build/(hot)deploy which could be solved by trashing server's work/temp folders or spawning a clean server instance).
You need to make sure that there's only one OmniFaces library in the runtime classpath and that it ends up in WAR's /WEB-INF/lib.
This is not specifically related to websockets. It just happened to be the first OmniFaces-related class which is scanned by Weld. It could occur on any other CDI managed bean bundled in OmniFaces.
It could also be just a version change in pom, and maven build cache inconsistency.
A
mvn clean
helped in my case.
I'm using the primefaces framework to realise a lazy data table.
I imported the package:
import org.primefaces.model.LazyDataModel;
in my EventViewer ManagedBean class.
I put the primefaces-6.1.jar in the WEB-INF/lib folder.
After deploying the project on JBoss AS, when loading the page I get the following exception:
2017-07-25 18:12:13,817 ERROR [javax.enterprise.resource.webcontainer.jsf.managedbean] JSF will be unable to create managed bean eventViewer when it is requested. The following problems where found:
- Bean or property class com.imnet.oam.fe.event.EventViewer for managed bean eventViewer cannot be loaded due to a missing dependency: org/primefaces/model/LazyDataModel.
2017-07-25 18:12:13,817 ERROR [javax.enterprise.resource.webcontainer.jsf.application] Error Rendering View[/event.xhtml]
com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean eventViewer. The following problems were found:
- Bean or property class com.imnet.oam.fe.event.EventViewer for managed bean eventViewer cannot be loaded due to a missing dependency: org/primefaces/model/LazyDataModel.
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:265)
at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIData.getValue(UIData.java:732)
at org.primefaces.component.api.UIData.getDataModel(UIData.java:764)
at org.primefaces.component.datatable.DataTable.loadLazyData(DataTable.java:1097)
[...]
This is the main error:
- Bean or property class com.imnet.oam.fe.event.EventViewer for managed bean eventViewer cannot be loaded due to a missing dependency: org/primefaces/model/LazyDataModel.
How do I solve it?
I have the below CDI managed bean:
#Named
#SessionScoped
public class InfoPageController implements Serializable {
#Inject
private InfoPageMapper mapper;
}
It throws the below exception during deployment to GlassFish 4.1:
Exception while loading the app : CDI deployment failure:WELD-001413: The bean Managed Bean [class de.triaconsulting.cashyourgame.fe.controller.InfoPageController] with qualifiers [#Default #Any #Named] declares a passivating scope but has a non-passivation-capable dependency Managed Bean [class de.triaconsulting.cashyourgame.fe.mapper.InfoPageMapper] with qualifiers [#Any #Default]
org.jboss.weld.exceptions.UnserializableDependencyException: WELD-001413: The bean Managed Bean [class de.triaconsulting.cashyourgame.fe.controller.InfoPageController] with qualifiers [#Default #Any #Named] declares a passivating scope but has a non-passivation-capable dependency Managed Bean [class de.triaconsulting.cashyourgame.fe.mapper.InfoPageMapper] with qualifiers [#Any #Default]
at org.jboss.weld.bootstrap.Validator.validateInjectionPointPassivationCapable(Validator.java:477)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:395)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:291)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:165)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:529)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:515)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:490)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:419)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
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:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
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:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
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:561)
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:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
How is this caused and how can I solve it?
The solution first, followed by an explanation:
The simplest you can do is mark the field InfoPageMapper mapper in InfoPageController as transient:
#Named
#SessionScoped
public class InfoPageController implements Serializable {
#Inject
transient private InfoPageMapper mapper;
And now the explanation:
The error message states this in readable language:
The bean InfoPageController, which is SessionScoped, must be
serializable, but it requires InfoPageMapper, which is not
serializable nor transient - it is not possible to determine how to
serialize InfoPageController.
In CDI, there are some scopes (most often SessionScope) which require beans to be Serializable - mostly because they are somehow connected to HTTP Session, which can contain more objects that fit into memory and from time to time the server may need to swap them to disk.
It seems you got this because InfoPageController implements Serializable. But this is not enough according to Java serialization principles. You need to ensure that all member fields of your Serializable class are one of:
- primitive type (int, boolean)
- an object that is serializable (all serialization rules apply recursively)
- the field is marked with keyword transient (which is placed at the same level as e.g. private keyword)
The trick with CDI is that you may mark all injected fields as transient, because they are injected again when the object is deserialized from disk into memory. Therefore you will not loose the transient object which would otherwise be null when deserialized, because it was not stored to disk previously.
Another solution is to make the injected bean InfoPageMapper serializable too. But then the problem may repeat recursively with fields injected into InfoPageMapper. Transient keyword solves your problem where it happens and does not force other benas to be serializable if they don't need to be.
By your server error message, check de.triaconsulting.cashyourgame.fe.mapper.InfoPageMapper.
Is InfoPageMapper implements Serializable or not?
You inject InfoPageMapper object in Session Scope of InfoPageController object.
Session scope objects and it's member need to serialize. So InfoPageMapper object must be able to serialize.
So InfoPageMapper must be implement Serializable Interface.
If you don't want to serialize InfoPageMapper object in InfoPageController, you can set transient keyword at this variable.
I am testing JSF 2.2 Faces flows in a PrimeFaces application and when I replace h:button with p:button the link stops working.
In JSF 2.2 you can specify, for example, the flow_id in the "outcome" of a h:button. This seems not to work in PF . The exception I'm getting is:
[ERROR ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.servlet.ServletException: WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4898)
at [internal classes]
Caused by: javax.servlet.ServletException: WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:230)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1285)
at [internal classes]
at com.servengine.servlet.EncodingFilter.doFilter(EncodingFilter.java:44)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at [internal classes]
at com.servengine.servlet.ServengineWebFilter.doFilter(ServengineWebFilter.java:136)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
... 1 more
Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.faces.flow.FlowScoped
at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:708)
... 7 more
I have also got other exceptions when including flow ids in p:commandButton action, which work in h:commandButton.
Thanks.
Edit: I'm using PF version 5.2.6.
I am trying to assign values to my dropdown during page load. I followed the way which is given in this link.
Invoke JSF managed bean action on page load
As per the link, i have tried using both the annotation and constructor type.
but its an exception for me,
SEVERE: An exception occurred
javax.faces.FacesException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: javax.el.ELException: Detected cyclic reference to managedBean loginBean
Caused by: javax.faces.el.EvaluationException: Detected cyclic reference to managedBean loginBean
I have just tried to call a function, in that annotated method or constructor,
that is,
#PostConstruct
public void init()
{
receiveclass r=new receiveclass();
r.retrieve();
}
i cant able to figure out the problem.
Detected cyclic reference to managedBean loginBean
You're injecting two different managed beans in each other as #ManagedProperty. This isn't allowed. It should be an one-way injection. Remove the #ManagedProperty referencing the one bean from the other bean.