3 Replies Latest reply on Sep 18, 2006 12:35 PM by Gavin King

    Stateful session bean serialization error.

    Mark French Newbie

      Hi,

      I have a problem that when one of my stateful session beans is passivated/loaded it throws the following error:

      javax.faces.el.EvaluationException: Exception while invoking expression #{loadPassage.load}
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
       at org.jboss.seam.core.Pages.callAction(Pages.java:161)
       at org.jboss.seam.core.Pages.callAction(Pages.java:139)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:128)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:98)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:50)
       at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersBefore(LifecycleImpl.java:520)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:342)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.RuntimeException: org.jboss.serial.exception.SerializationException: Could not create instance of org.apache.myfaces.context.servlet.ServletFacesContextImpl - org.apache.myfaces.context.servlet.ServletFacesContextImpl
       at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:365)
       at org.jboss.ejb3.stateful.StatefulBeanContext.getInstance(StatefulBeanContext.java:309)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:75)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:188)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy358.load(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
       ... 27 more
      Caused by: org.jboss.serial.exception.SerializationException: Could not create instance of org.apache.myfaces.context.servlet.ServletFacesContextImpl - org.apache.myfaces.context.servlet.ServletFacesContextImpl
       at org.jboss.serial.classmetamodel.ClassMetaData.newInstance(ClassMetaData.java:327)
       at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:239)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
       at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
       at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
       at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
       at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
       at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
       at org.jboss.serial.persister.ArrayPersister.readObjectArray(ArrayPersister.java:196)
       at org.jboss.serial.persister.ArrayPersister.readData(ArrayPersister.java:172)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:411)
       at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:81)
       at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readObject(DataContainer.java:639)
       at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:165)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333)
       at org.jboss.serial.io.MarshalledObject.get(MarshalledObject.java:68)
       at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:342)
       ... 44 more
      Caused by: java.lang.InstantiationException: org.apache.myfaces.context.servlet.ServletFacesContextImpl
       at java.lang.Class.newInstance0(Class.java:335)
       at java.lang.Class.newInstance(Class.java:303)
       at org.jboss.serial.classmetamodel.ClassMetaData.newInstance(ClassMetaData.java:319)


      Is there any way round this problem the stateful session bean code is as follows:

      @Stateful
      @SerializedConcurrentAccess
      @Scope(SESSION)
      @Name("loadPassage")
      @Conversational(ifNotBegunOutcome = "main")
      public class LoadPassageAction extends BaseHttpAction implements LoadPassage {
       private static final String GET_STATISTICS = "getStatistics";
      
       private static final String EMPTY_PAGE = "empty";
      
       private static final Log logger = LogFactory
       .getLog(LoadPassageAction.class);
      
       @In(value = "#{current_queue}", scope = ScopeType.SESSION)
       private String queueKey;
      
       private transient PassageQueue passageQueue = null;
      
       @In
       private FacesContext facesContext;
      
       @In
       private Context sessionContext;
      
       @RequestParameter
       private String page;
      
       @RequestParameter
       private String action;
      
       /**
       * Contains list of passage contexts.
       */
       private final Map<Integer, LoadPassageContext> loadPassageContexts = new HashMap<Integer, LoadPassageContext>();
      
       // action supporting parameters
       /**
       * Passage id.
       */
       @RequestParameter
       private String id;
      
       /**
       * Review licence plate number.
       */
       @RequestParameter
       private String lpn;
      
       /**
       * Jurisdiction.
       */
       @RequestParameter
       private String jurisdiction;
      
       /**
       * Vehicle class.
       */
       @RequestParameter
       private String vehicleClass;
      
       /**
       * Plate Type.
       */
       @RequestParameter
       private String plateType;
      
       /**
       * Passage vehicle make.
       */
       @RequestParameter
       private String make;
      
       /**
       * Passage vehicle model.
       */
       @RequestParameter
       private String model;
      
       /**
       * Passage vehicle model.
       */
       @RequestParameter
       private String colour;
      
       /**
       * Passage reviewComment.
       */
       @RequestParameter
       private String comment;
      


      The bean has a mapping in the pages.xml and used by a legacy web app which pass in parameters via a get and expects javascript back.

      <pages>
       <page view-id="/loadUser/*" action="#{loadUser.load}" />
       <page view-id="/loadPassage/*" action="#{loadPassage.load}" />
       <page view-id="/loadStatus/*" action="#{loadStatus.load}" />
      </pages>


      Any ideas or is it better to use servlets for this?