wood burning stoves 2.0*
The moose likes JSF and the fly likes Concurrency Issue with JSF - javax.faces.FacesException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Concurrency Issue with JSF - javax.faces.FacesException" Watch "Concurrency Issue with JSF - javax.faces.FacesException" New topic
Author

Concurrency Issue with JSF - javax.faces.FacesException

K G Ramya
Greenhorn

Joined: Mar 20, 2006
Posts: 7
Hi All,

We are developing a web application using JSF. When two users try to do the same action in the website one of the request goes fine but the other user gets the runtime exception "javax.faces.FacesException: javax.faces.FacesException: Can't instantiate class: 'com.action.Search'.. ".

I guess that the Backing bean is not allowing two threads to enter into its life cycle methods concurrently. (My backing bean Search.java extends the AbstractPageBean.) Could anyone help me out in resolving this issue.

Thanks & Regards
Ramya.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

What scope does your search backing bean have? It should be session level or request level.


Customer surveys are for companies who didn't pay proper attention to begin with.
K G Ramya
Greenhorn

Joined: Mar 20, 2006
Posts: 7
The Search Bean is defined in the request scope.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

That shoots down your original hypothesis. Request backing beans are constructed and destroyed on a per-request basis. So there cannot be a concurrency issue.

You need to dig through the various logfiles and see if you can't find a stacktrace that say why the bean cannot be instantiated. Usually it would be something like no default constructor was defined or there was construction method signature mismatch.
K G Ramya
Greenhorn

Joined: Mar 20, 2006
Posts: 7
On further debugging I found out that I get the exception in one of the sessions, Only when I try accessing the OrderSearch.jsp from two different browser sessions at the same time and that too "for the first time".
Once the backing bean gets loaded, I am not getting this problem.

The exception is thrown while binding the BackingBean to the h:form.
i.e at the line
<h:form binding="#{OrderSearch.orderSearch}" id="orderSearch">

This is the exception trace:

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1453)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1234)
at java.beans.Beans.instantiate(Beans.java:187)
at java.beans.Beans.instantiate(Beans.java:48)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:203)
....
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:209)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:298)
....
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:308)
at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:78)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
....
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:386)
at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:999)
at javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1026)
at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:739)
at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)
at com.sun.faces.taglib.html_basic.FormTag.doStartTag(FormTag.java:345)
at org.apache.jsp.jsf.order.OrderSearch_jsp._jspx_meth_h_form_0(OrderSearch_jsp.java:260)
at org.apache.jsp.jsf.order.OrderSearch_jsp._jspx_meth_f_view_0(OrderSearch_jsp.java:233)
at org.apache.jsp.jsf.order.OrderSearch_jsp._jspService(OrderSearch_jsp.java:160)

Is there anyway to solve this issue ?

Regds
Ramya.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concurrency Issue with JSF - javax.faces.FacesException
 
Similar Threads
Integration problems using h:selectOneMenu
PropertyNotFound in EL
Backingbean in session scope not working
JSF Portlet and instance variables
calling action functions from different beans