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.

XMLWordPrintable

    • 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.

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

                Created:
                Updated: