Thursday, July 9, 2009

java.rmi.NoSuchObjectException: Bean has been deleted

I was facing 'java.rmi.NoSuchObjectException: Bean has been deleted' for the stateful bean instance.
While reading about the error, I came across very useful information, which I would like to share with.

This error can specifically occur in one of the following two scenarios

1. Calling a method on the bean which is deleted from cache and disk.
2. Calling EJBHome.remove() on bean, which is deployed on cluster.

#1. Default idle time out of a session bean from a container cache is 600 seconds. After 600 seconds if the max-bean-in-cache size is reached, then the corresponding bean is removed from the cache and passivated to hard disk. When client tries to access this passivated bean after it has been removed from hard disk from container, server will throw the above error.

Possible Solution : In weblogic-ejb-jar.xml, we can configure the idle-timeout-seconds (more than 600). Bean will be passivated to hard disk from cache after idle timeout seconds are reached.
Also configuring session-timeout-seconds, which specifies how long the EJB container waits before removing an idle stateful session bean from disk. While passivated, EJBs are not in memory and are not immediately available for client requests, as they are when in the cache.

#2. Bea suggest to use EJBObject.remove(), instead of EJBHome.remove(), to remove a stateful session bean that is deployed on cluster.

No stateful session EJB instances exist in WebLogic Server at startup.
When I read upon more, I found, the rules that govern the passivation of stateful session beans vary, based on the value of the beans cache-type element,
which can be:
1. LRU - Least Recently Used (Eager Passivation)
2. NRU - Not Recently Used (Lazy Passivation)

The default value of the cache type is NRU. With this, the minimum cache size is 8.
If we configure max-bean-in-cache as less than 3, the weblogic will use max-bean-in-cache value as 8.
This is the default strategy and also an eager remove strategy in which the container decides to remove the bean instead of passivating after idle-timeout-seconds.

3 comments:

Phái said...

Thanks, in my case, i set like bellow



1200

Phái said...
This comment has been removed by the author.
Phái said...

http://docs.oracle.com/cd/E11035_01/wls100/ejb/DDreference-ejb-jar.html#wp1114380

SpringBoot: Features: SpringApplication

Below are a few SpringBoot features corresponding to SpringApplication StartUp Logging ·          To add additional logging during startup...