View Full Version : Closing Application Context
Aug 26th, 2005, 03:57 AM
I have a slsb extending AbstractStatelessSessionBean deployed to JBoss4.0.2. When it throws an exception from a remote method I notice from the logs that the Application Context is closed.
Is this standard behaviour? Are there any alternative approaches to avoid this?
Any help greatly appreciated, thanks in advance.
Aug 30th, 2005, 06:20 PM
Could this be because JBoss removes the bean from the pool when a remote exception occurs. If you have used the defaults when sub-classing, each bean has its own context, which will therefore be closed, see:
for a singleton based context, which is also more performant. Note that you need to set one of your beans to have min instances in the pool to >0 to keep the context permenently in the JVM, otherwise during periods of inactivity your container may decide to remove all bean from the pool, which causes the context to be closed.
Sep 2nd, 2005, 04:03 AM
The Bean was throwing an exception that subclassed runtime exception. I guess this caused JBoss to unload the Bean and hence the context. Changing the exception to a checked exception meant that the remote exception was thrown but the Bean was not unloaded, so the context was not reloaded on next request.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.