Hello all,
from time to time I get a Could not find stateful bean
error message when I log into my application.
I figured out that this error is caused by the access to a Application scoped Seam component when the application wasn't used for a certain amount of time.
Obviously, the container removed the SFSB due to inactivity, and on the next request, Seam still thinks the Bean should be available (since it is application scoped).
How can I get around with this?
As a first approach, I added a CacheConfig annotation to my bean:
@Stateful @CacheConfig(removalTimeoutSeconds = 0, idleTimeoutSeconds = 0) @Name("appglobal") @Scope(ScopeType.APPLICATION) @AutoCreate public class WebAppGlobalImpl implements WebAppGlobal {
Hoping that 0 means no timeout (did not find documentation on this). It seems to work, but it's kind of workaround.
What is the right way?
Marcus.
I think you did the right thing. The ideal thing would be to have Seam set the timeouts to 0 for APPLICATION-scoped beans.