• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Intermittent issue with JSF Ajax implementation.

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



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.

Thanks
Ranjan



 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


Thanks
Ranjan
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The code snippet of my JSF

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

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

<h:column>
<h:outputText
value="#{EventHandler.generateStatus}"
styleClass="errorDetails">
</h:outputText>
</h:column>
</h:panelGrid>

<h:message id="errorMessage" for="upForm"
styleClass="error"/>



<%
/* Button bar */
%>
<n:searchResultsButtonBar

.................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.

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


thanks in advance
Ranjan

 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic