The moose likes JSF and the fly likes Intermittent issue with JSF Ajax implementation. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Intermittent issue with JSF Ajax implementation." Watch "Intermittent issue with JSF Ajax implementation." New topic

Intermittent issue with JSF Ajax implementation.

ranjan Khaba

Joined: Jan 16, 2008
Posts: 22

I have a problem with the Ajax implementation with my JSF page.

The Ajax is polling a text area for every 3 seconds. Everything is working fine, but there is an intermittent problem.

Problem: - The JSF page has “Import” and “Restore” functionality. I got the error, If I performed the “import” and “restore” operation multiples times. The log doesn’t give any proper information. The log says NoSuchElementException.

I am facing a tough time to solve this problem, because I cannot debug and the log doesn’t provide proper information.

Any suggestion will be highly appreciated.


Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You say there is no message and stacktrace in the logs?

Anyway, I recognize NoSuchElementException in a new JSF request as possibly wrong data loading logic for dropdown items (f:selectItems). Do you use dropdowns in your JSF page? If so, you need to ensure that the getter behind f:selectItems returns exactly the same list in the subsequent request as it was during the request for display.
ranjan Khaba

Joined: Jan 16, 2008
Posts: 22
No, there is no selectItem.

The JSF page has Ajax pooling Area, some button "import", "Restore"... and display a data table. There is no Ajax application to the dataTable part.

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Without an exception message and stacktrace there is in fact no information to tell you about the cause (and thus also the solution) of the problem.

You´ve it in your hands now. Read the appserver logs once more and/or debug your application.
ranjan Khaba

Joined: Jan 16, 2008
Posts: 22
The Text pooling area is showing the status of a Job running a backend. The job information is getting from the Spring singleton bean.

the log does not contains any information about my classes. It prints NoSuchelementException.

Here is snippet of log.

at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at javax.faces.component._FacetsAndChildrenIterator.next(_FacetsAndChildrenIterator.java:56)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:626)
at javax.faces.component.UIForm.processValidators(UIForm.java:73)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:627)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:149)
at org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:57)
at org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:319)
at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:333)
at org.apache.myfaces.lifecycle.ProcessValidationsExecutor.execute(ProcessValidationsExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
... 40 more
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
See, that´s more information!

Start here: http://www.google.com/search?q=java.util.NoSuchElementException+at+javax.faces.component._FacetsAndChildrenIterator.next(_FacetsAndChildrenIterator.java%3A56)

Good luck.
ranjan Khaba

Joined: Jan 16, 2008
Posts: 22
with lot of Analysis, below are the some important points.

Reason: - To dupe the problem, I have to do “Import” and “Restore” operation many time. The problem is intermittent and the log does not give proper information. The solution are trying based on below points.

1. Any stream which does not closed properly.
2. Any Thread issue.
3. Any variable setting and reading issue.

The ajax region is applied to only the status panel Grid. It is poll for every 3 seconds. It check the status for the backend job.
The ArrayList display in the datatable is not a part of ajax implementation.
The issue is getting during the “Restore” operation.

Probable Root cause: -

When I debug the code, the method to ge the ArrayList is invoke every three seconds, which should not be the case.

During the “Restore” operation the ArrayList is creating the issue [Related to point no 3]. This is the reason why “NoSuchElementException” is thrown.

If I can limit the implementation of the ajax to only the status panel grid, then the problem may be resolved.

The code snippet of my JSF

<!-- AJAX for Generation status -->
<a4j:poll id="pollingTextArea"
interval="3000" enabled="true" />

<!-- Generation status Panel-->
<h:panelGrid id="generationStatus" columns="2"
<hutputText value="#{bundle.generationStatus}:"/>


<h:message id="errorMessage" for="upForm"

/* Button bar */

.................button declaration.....

then data table handler which get the ArrayList. This part is being called for every two second. Only the method generationStatus should be called every three seconds.


thanks in advance

I agree. Here's the link: http://aspose.com/file-tools
subject: Intermittent issue with JSF Ajax implementation.