Passivation prevention is a bean session state in glass 4

I have a statefull bean session that introduces an advanced entity manager. When I deploy the application for some time, an exception is thrown indicating that the advanced entity manager is not serialized. after some searching, I found that the cause of this exception might be bean passivation.

  • Is there a way to stop passivation in a glass fish (I found that there is a problem, but I can not find a way)?
  • Is it right for the container to try to serialize the object manager when passaging sfsb?
  • Could there be another reason for this exception?

Note : PLZ does not ask about the code, it is just a bean state with an extended entity manager called by the cdi bean application scope.

+4
source share
1 answer

You must set passivationCapable to false.

passivationCapable Indicates whether this session bean is passivable

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

 . . .

}
+3
source

All Articles