File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes SessionScoped not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "SessionScoped not working" Watch "SessionScoped not working" New topic

SessionScoped not working

adam bilyone

Joined: Aug 14, 2011
Posts: 16
I used hibernate to persist managed bean to database. Also if i retrieve the object to the database i will like to used it on some other pages, this force me to mark the managed bean as a SessionScope, that means i am expecting only one instance of the bean to be create and it works. However, when i attempt to make changes to the bean and update it to the database, i got the following exception. Please can someone help me out.
Thank you in anticipation of your prompt and favourable reply.

WARNING: #{advertManager.updateCustomer()}: java.lang.IllegalStateException
javax.faces.FacesException: #{advertManager.updateCustomer()}: java.lang.IllegalStateException
at com.sun.faces.application.ActionListenerImpl.processAction(
at javax.faces.component.UICommand.broadcast(
at javax.faces.component.UIViewRoot.broadcastEvents(
at javax.faces.component.UIViewRoot.processApplication(
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(
at com.sun.faces.lifecycle.Phase.doPhase(
at com.sun.faces.lifecycle.LifecycleImpl.execute(
at javax.faces.webapp.FacesServlet.service(
at org.apache.catalina.core.StandardWrapper.service(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardPipeline.doInvoke(
at org.apache.catalina.core.StandardPipeline.invoke(
at com.sun.enterprise.web.WebPipeline.invoke(
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.doService(
at org.apache.catalina.connector.CoyoteAdapter.service(
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(
at com.sun.grizzly.http.ProcessorTask.doProcess(
at com.sun.grizzly.http.ProcessorTask.process(
at com.sun.grizzly.http.DefaultProtocolFilter.execute(
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(
at com.sun.grizzly.DefaultProtocolChain.execute(
at com.sun.grizzly.DefaultProtocolChain.execute(
at com.sun.grizzly.http.HttpProtocolChain.execute(
at com.sun.grizzly.ProtocolChainContextTask.doCall(
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(
at com.sun.grizzly.util.AbstractThreadPool$
Caused by: javax.faces.el.EvaluationException: java.lang.IllegalStateException
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(
at com.sun.faces.application.ActionListenerImpl.processAction(
... 32 more
Caused by: java.lang.IllegalStateException
at com.sun.faces.context.FacesContextImpl.assertNotReleased(
at com.sun.faces.context.FacesContextImpl.addMessage(
at com.bilyone.service.AdvertManager.updateCustomer(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at javax.el.BeanELResolver.invokeMethod(
at javax.el.BeanELResolver.invoke(
at javax.el.CompositeELResolver.invoke(
at com.sun.el.parser.AstValue.invoke(
at com.sun.el.MethodExpressionImpl.invoke(
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(
at org.jboss.weld.el.WeldMethodExpression.invoke(
at com.sun.faces.facelets.el.TagMethodExpression.invoke(
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(
... 33 more
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

I cannot tell for certain based on the available information, but I think that you are attempting to use a persistent Domain Model Object as a UI Model object (backing bean).

That rarely works, since the mechanism that creates and maps backing beans expects a more static set beans as singleton objects whereas the Domain Model is usually multiple object instances.

Because of that, the common way to access domain model objects via JSF is to make them properties of backing beans rather that attempting to use them as backing beans directly.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: SessionScoped not working
jQuery in Action, 3rd edition