bob-cac
bob-cac

Reputation: 1302

preventing passivation is stateful session bean in glassfish 4

I have a stateful session bean that inject extended entity manager. When I deploy the application for some time, an exception occur indicating that extended Entity manager is not serialized. after some search I found that passivation of the bean might be the cause of this exception.

  1. Is there a way to stop passivation in glassfish (I found that there is an issue but can't find a way)?
  2. Is it right for container to try to serialize entity manager when passivating the sfsb?
  3. Could there be another reason for this exception to occur?

Note: please don't ask about the code it is just a stateful bean with extended entity manager called by an application scope cdi bean.

Upvotes: 4

Views: 862

Answers (1)

john miran
john miran

Reputation: 393

You must set passivationCapable to false.

passivationCapable Specifies whether this stateful session bean is passivation capable

@Stateful(passivationCapable=false)
public class HelloBean {
    private NonSerializableType ref = ...

 . . .

}

Upvotes: 3

Related Questions