A CacheFullException will be thrown when no more beans can be inserted into the cache. This is because the cache is full with beans which are currently participating in a transaction, or the instances cannot be removed from cache because of other reasons. If any bean in the cache can be found that is not active in a transaction, it will be replaced by the current one. The index for the beans in cache is (primary key, transaction).
CacheFullException - for Entity Beans
There are different reasons that can lead to a CacheFullException for Entity beans:
1. The property
Note that for WLS 6.1, after upgrading to a service pack equal or higher than SP4, this can be an issue, as the
2.The implementation of the primary key class is incorrect. The related methods equals() and hashcode() need to return unique values for each and every possible primary key value. If this is not the case, there may be instances in the cache that are not reused and not removed from the cache even though they are no longer participating in a transaction. This means the cache may contain instances of entity beans that are not active in a transaction, but cannot be removed, as the index into the cache is not working because of the primary key (PK) class that is improperly implemented.
Note: It is good practice to ensure that all PK classes have been implemented correctly in your code. See sample below where a small coding error caused a problem:
public boolean equals(Object o){
if (o instanceof AbcPK) {
AbcPK otherKey = (AbcPK)o;
return (companyId.equals(otherKey.string1)&& string1.equals(otherKey.companyId));
} else
return false;
}
The code is comparing the wrong fields as follows:
companyId.equals(otherKey.string1)
should be:
companyId.equals(otherKey.companyId)
and
string1.equals(otherKey.companyId)
should be:
string1.equals(otherKey.string1)
3. If the property
4. For WebLogic Server version 6.1, please ensure that the property
For versions greater or equal than WLS 7.0 SP5 or 8.1 SP3, the property
5. For EJBs that use container managed relationships, relationship-caching can be turned on in order to improve performance. Please check the related