VERY IMPORTANT!: @EJB injection error when using Serializabl
juangon May 8, 2009 7:59 AMHi!
After testing some things to improve memory performance changing web.xml to this value:
<context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param>
I encountered some strange error when I clicked on a rich:datatable, obtained from a SerializableDataModel in REQUEST scope (that yas working perfectly in server state saving method):
----- Root Cause ----- javax.faces.FacesException: javax.ejb.EJBException: nested exception is: java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! vmcid: 0x0 minor code: 0 completed: No at org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1027) at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1140) at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1150) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001) at javax.faces.component.UIForm.processDecodes(UIForm.java:203) at org.ajax4jsf.component.UIAjaxRegion.processDecodes(UIAjaxRegion.java:103) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1001) at org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:392) at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238) at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:544) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:531) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:420) at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:351) at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:230) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:633) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: javax.ejb.EJBException: nested exception is: java.rmi.RemoteException: CORBA BAD_OPERATION 0 No; nested exception is: org.omg.CORBA.BAD_OPERATION: The delegate has not been set! vmcid: 0x0 minor code: 0 completed: No at ...
The code for the SerializableDataModel is like this:
public class SomePaginationBean extends SerializableDataModel implements Serializable{ private transient Logger log = Logger.getLogger(this.getClass()); @EJB(mappedName = "ejb/Remote") private RemoteInterface dataProvider;
The faces-config.xml is like this:
<managed-bean> <description>Some controller</description> <managed-bean-name>remotePaginationBean</managed-bean-name> <managed-bean-class>.....RemotePaginationBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>
and the .xhtml is like this:
<rich:dataTable id="remotePaginationBean" value='#{remotePaginationBean}'
It's a very strange thing, because the datable is rendered correctly (and the EJB perfectly injected) the first time. After click inside a commandLink inside the datatable (I suppose when the datatable is being decoded) it breaks with the error written above.
Any clues about this?
I thought my app would work without any problems in CLIENT state saving method, but I was wrong.
I am using JSF SUN RI (Mojarra) 1.2_b04, Sun Glassfish v2UR2 and richfaces 3.3.1 CR1.
Thanks very much!