Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8384

Passivation of a @Stateful session bean with an @Inject'ed @Stateless session bean fails with not-serializable error.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • No Release
    • 6.0.0.M4
    • None
    • None
    • Hide

      1. Create the following objects:

      [Bean]
      package beans;

      import javax.ejb.PrePassivate;
      import javax.ejb.Stateful;
      import javax.enterprise.context.ConversationScoped;
      import javax.inject.Inject;
      import javax.inject.Named;

      import org.jboss.ejb3.annotation.CacheConfig;

      import service.TestService;

      @Named
      @ConversationScoped
      @Stateful
      @CacheConfig(idleTimeoutSeconds=10)
      public class TestBean {

      @Inject
      private TestService testService;

      private String property = "test";

      public String getProperty()

      { return this.property; }

      public void setProperty(String property)

      { this.property = property; }

      @PrePassivate
      public void passivate()

      { System.out.println("About to passivate: "+this.getClass().getName()); }

      }

      [Service]
      package service;

      import javax.ejb.Stateless;

      @Stateless
      public class TestService {}

      [JSF page]
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

      <h:body>
      <h:outputText value="#

      {testBean.property}

      "/>
      </h:body>
      </html>

      2. Attempt to view the JSF page in JBoss6 M4
      3. 10 seconds later... stack trace:

      10:59:04,840 ERROR [org.jboss.ejb3.cache.simple.SimpleStatefulCache.TestBean] problem passivation thread: javax.ejb.EJBException: Could not passivate; failed to save state
      at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:409) [:1.5.0-alpha-4]
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:382) [:1.5.0-alpha-4]
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:300) [:1.5.0-alpha-4]
      Caused by: java.io.IOException: Metadata Serialization Error
      at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:193) [:6.0.0.20100721-M4]
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206) [:6.0.0.20100721-M4]
      at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182) [:6.0.0.20100721-M4]
      at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90) [:6.0.0.20100721-M4]
      ...

      Show
      1. Create the following objects: [Bean] package beans; import javax.ejb.PrePassivate; import javax.ejb.Stateful; import javax.enterprise.context.ConversationScoped; import javax.inject.Inject; import javax.inject.Named; import org.jboss.ejb3.annotation.CacheConfig; import service.TestService; @Named @ConversationScoped @Stateful @CacheConfig(idleTimeoutSeconds=10) public class TestBean { @Inject private TestService testService; private String property = "test"; public String getProperty() { return this.property; } public void setProperty(String property) { this.property = property; } @PrePassivate public void passivate() { System.out.println("About to passivate: "+this.getClass().getName()); } } [Service] package service; import javax.ejb.Stateless; @Stateless public class TestService {} [JSF page] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> <h:body> <h:outputText value="# {testBean.property} "/> </h:body> </html> 2. Attempt to view the JSF page in JBoss6 M4 3. 10 seconds later... stack trace: 10:59:04,840 ERROR [org.jboss.ejb3.cache.simple.SimpleStatefulCache.TestBean] problem passivation thread: javax.ejb.EJBException: Could not passivate; failed to save state at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:409) [:1.5.0-alpha-4] at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:382) [:1.5.0-alpha-4] at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:300) [:1.5.0-alpha-4] Caused by: java.io.IOException: Metadata Serialization Error at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:193) [:6.0.0.20100721-M4] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206) [:6.0.0.20100721-M4] at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182) [:6.0.0.20100721-M4] at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90) [:6.0.0.20100721-M4] ...

      If a @Stateful session bean has an injected @Stateless session bean it cannot be passivated.

            [JBAS-8384] Passivation of a @Stateful session bean with an @Inject'ed @Stateless session bean fails with not-serializable error.

            Due to feedback from the community, I have split the AS7 and AS6 projects and reopened all unscheduled AS6 issues that are a year or less old. This will make it easier community members to find and work on them.

            Future releases beyond 6.1 can be done provided a community member steps up to coordinate them.

            Jason Greene added a comment - Due to feedback from the community, I have split the AS7 and AS6 projects and reopened all unscheduled AS6 issues that are a year or less old. This will make it easier community members to find and work on them. Future releases beyond 6.1 can be done provided a community member steps up to coordinate them.

            Now that work is well underway with AS7, all previous community releases are end-of-lifed. So, all issues not directly assigned to an AS7 release are being closed.

            JBoss EAP is our supported enterprise version of AS, and you can file your issues against any release during its very long support window via CSP/RHN.

            If you believe your issue is still relevant to AS7 then please verify it and reopen.

            Jason Greene added a comment - Now that work is well underway with AS7, all previous community releases are end-of-lifed. So, all issues not directly assigned to an AS7 release are being closed. JBoss EAP is our supported enterprise version of AS, and you can file your issues against any release during its very long support window via CSP/RHN. If you believe your issue is still relevant to AS7 then please verify it and reopen.

            This problem persists in JBoss 6 Final and essentially makes the server unusable.

            Here is Eclipse project + WAR deployment for reproducing the error:

            http://community.jboss.org/servlet/JiveServlet/downloadBody/16469-102-1-121200/TestCDI.zip

            Discussion about the problem is at:

            http://community.jboss.org/message/584091

            Miroslav Pavleski (Inactive) added a comment - This problem persists in JBoss 6 Final and essentially makes the server unusable. Here is Eclipse project + WAR deployment for reproducing the error: http://community.jboss.org/servlet/JiveServlet/downloadBody/16469-102-1-121200/TestCDI.zip Discussion about the problem is at: http://community.jboss.org/message/584091

            I've noticed there are a lot of people with similar issues that essentially boil down to utilizing a non-serializable class in the SFSB. Note that in my example, there is one property that is serializable (java.lang.String) and an empty @Stateless sesssion bean. Given that @Stateless session beans can be passivated by the container I assume that this should just work.

            Ken Britton (Inactive) added a comment - I've noticed there are a lot of people with similar issues that essentially boil down to utilizing a non-serializable class in the SFSB. Note that in my example, there is one property that is serializable (java.lang.String) and an empty @Stateless sesssion bean. Given that @Stateless session beans can be passivated by the container I assume that this should just work.

              Unassigned Unassigned
              kenbritton_jira Ken Britton (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: