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.
Related
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'm trying to use Omnifaces's validator in the following lines of code
inside composite component inplementation:
<p:inputText id="#{cc.attrs.id}" size="12" maxlength="10" value="#{cc.attrs.holder.idHolderPk}"
label="#{cc.attrs.label}" styleClass="content-right"
disabled="#{not empty cc.attrs.disabled?cc.attrs.disabled:false}">
<f:validator disabled="#{!cc.attrs.required}" validatorId="#{cc.attrs.validatorName}"/>
<o:validator disabled="#{empty cc.attrs.beanValidation ? true : false}" validatorId="javax.faces.Bean" validationGroups="#{cc.attrs.beanValidation}"/>
<p:ajax event="blur" listener="#{holderHelperBean.findHolder()}"
process="#this" update="outpnlHolder"
oncomplete="#{not empty cc.attrs.remoteListener ? cc.attrs.remoteListener : ''}"/>
<pe:keyFilter mask="pint"/>
</p:inputText>
But I get the following error:
ERROR [org.infinispan.transaction.TransactionCoordinator] (ajp-118)
ISPN000097: Error while processing a prepare in a single-phase transaction: org.infinispan.CacheException: java.lang.RuntimeException: Failure to marshal argument(s)
at org.infinispan.util.Util.rewrapAsCacheException(Util.java:542)[0m
at org.infinispan.remoting.transport.jgroups.CommandAwareRpcDispatcher.invokeRemoteCommand(CommandAwareRpcDispatcher.java:186)[0m
at org.infinispan.remoting.transport.jgroups.JGroupsTransport.invokeRemotely(JGroupsTransport.java:515)[0m
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:173)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:194)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:251)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:238)
at org.infinispan.remoting.rpc.RpcManagerImpl.invokeRemotely(RpcManagerImpl.java:233)
Caused by: java.lang.RuntimeException: Failure to marshal argument(s)
Caused by: org.infinispan.marshall.NotSerializableException: org.omnifaces.taghandler.Validator
I am using Jboss 6.3 EAP in mode cluster with session replication, Omnifaces 1.8.1, Primefaces 4.0.13, Mojarra 2.1.28-jbossorg-5.
I am using o:validator to bean validation because I need dynamic disabled and rendered validation
When application is in standalone mode working fine without error message.
Putting <o:validator> directly inside <cc:implementation> had due to a logic bug the undesired side effect that a new instance of the validator is attached during render response of a postback (because it was expected that the <o:validator> was nested inside <my:composite> with the for attribute). JSF noticed this dynamic change and wanted to save it in the JSF view state so it could be restored on next postback, but it wasn't serializable and hence this exception.
The fix was simply to not re-attach it at all when already directly inside a composite component. It will be in OmniFaces 2.1.
I have a JSF application in which I use JSF h:inputText for accepting user data. I bind the input fields to java objects using managed beans which is mostly normal.
The data entered in the HTML form is saved periodically using sequential ajax calls. Sometimes the periodic save fails with error in looking up the mapped object to the input field(the error message says it can not find the java object). This may not happen for the next call to save the data though nothing is changed in the application. I can't figure out the pattern to reproduce this bug. When I try to debug printing the object values it works fine too. In the input value mapping I have nested objects which I suspect may have something to do with the error.
Here is the code snippet in JSF page.
<c:forEach var="doc"
items="#{trim.trim.act.relationship['patientSurgeons'].act.relationshipsList['physician']}"
varStatus="physicianIndex">
<table>
<tr>
<td><h:inputText
id="firstName#{physicianIndex.index}" placeholder="first name"
value="#{doc.act.participation['surgeon'].role.player.name.EN['L'].parts[0].ST.value}"
class="sidebyside small" />
</td>
Here is how the exception stack trace
15:52:55,239 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
javax.el.PropertyNotFoundException: /META-INF/tags/wizard/inputTextWithPlaceholder.xhtml #15,86 value="#{value}": /wizard/questionnaireWiz/patientPhysicians.xhtml #73,36 value="#{doc.act.participation['surgeon'].role.player.name.EN['L'].parts[0].ST.value}": Target Unreachable, identifier 'doc' resolved to null
at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
at javax.faces.component.UIInput.validate(UIInput.java:860)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
at javax.faces.component.UIInput.processValidators(UIInput.java:666)
at javax.faces.component.UIForm.processValidators(UIForm.java:229)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
What could I be missing here?
This construct will fail like that when the value behind <c:forEach items> is not available during process validations phase of the postback request and hence #{doc} evaluates to null. For example, because the #{trim} is a request scoped bean whose data is initialized via a <f:viewParam>. Making it a view scoped bean (and in case you're using Mojarra, ensuring that you're using at least 2.1.18), should fix it.
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.
I have a problem when using h:head tag. I am using JSF 2.0 Mojarra's implementation.
I try examples just like the ones provided here and here.
I always get the same error if I try to use h:head tag. If I use head, the everything is ok.
No problem using other tags, such h:body, h:form...
javax.servlet.ServletException: org/w3c/css/sac/ErrorHandler
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
java.lang.NoClassDefFoundError: org/w3c/css/sac/ErrorHandler
org.richfaces.resource.ResourceFactoryImpl.createCompiledCSSResource(ResourceFactoryImpl.java:192)
org.richfaces.resource.ResourceFactoryImpl.createDynamicResource(ResourceFactoryImpl.java:458)
org.richfaces.resource.ResourceFactoryImpl.createResource(ResourceFactoryImpl.java:430)
org.richfaces.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:268)
org.richfaces.resource.ResourceHandlerImpl.createResource(ResourceHandlerImpl.java:278)
com.sun.faces.renderkit.html_basic.StylesheetRenderer.encodeEnd(StylesheetRenderer.java:91)
javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
com.sun.faces.renderkit.html_basic.HeadRenderer.encodeHeadResources(HeadRenderer.java:101)
com.sun.faces.renderkit.html_basic.HeadRenderer.encodeBegin(HeadRenderer.java:76)
javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:824)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1641)
javax.faces.component.UIComponent.encodeAll(UIComponent.java:1646)
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:389)
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
I have a similar problem with this tag, such the mentioned here, but the solution didn't work for me, as it is not exactly the same problem.
It looks like h:head fails to load some resources for richfaces.
Check if your richfaces jars are in your project's WEB-INF/lib folder.