• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrency Issue with JSF - javax.faces.FacesException

 
K G Ramya
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What scope does your search backing bean have? It should be session level or request level.
 
K G Ramya
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Search Bean is defined in the request scope.
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic