EJB 1.1 CMP custom finder methods returning a Collection

Technote (troubleshooting)


Problem(Abstract)

This technote involves CMP v1.1 Entity Beans with finders that return a Collection of beans.

Symptom

In WebSphere® Studio Application Developer v5.x.x with WebSphere Application Server (WAS) v5.0.x, when the finder returns more than 25 beans, any invocation on the resulting Collection (like calling size()) results in the following server side exception:

java.lang.IllegalAccessException: com/ibm/ejs/persistence/RemoteEnumerator

This previously worked in WebSphere Studio Application Developer v4.0.x with WebSphere Application Server v4.0.x.


Cause

The problem is with the "lazy-loading" of collections in WebSphere 5.0.x, as only the first 25 entries are loaded initially and the rest are loaded "on demand". When the finder returns a Collection with less than 25 beans then any method invocation on the Collection works fine.

Resolving the problem

This problem emphasizes finders returning more then 25 items. You are not allowed to call the method size() on the returned collection. Use the method hasMoreElements().

To help diagnose the situation:

  • A WebSphere Application Server trace trace helps to determine the details of the situation. Enable the traces using the following trace string: com.ibm.ejs.container.*=all=enabled:com.ibm.ejs.persistence.*=all=enabled:com.ibm.ejs.csi.*=all=enabled.
  • Verify the Tx settings of the EJB's finder method (all home methods in case override is in place, and so forth), both of the actual finder methods and any methods that call it, if that is the scenario you are considering.

In the case of WebSphere Studio Application Developer v5.x, the trace.log would be located in the path you specify in the 'Trace output file' field on the 'Trace' page found in the Server configuration editor. By default, this is: <WSAD workspace>\.metadata\.plugins\com.ibm.etools.server.core\tmp<N>, where N refers to the server configuration number (i.e. tmp0, tmp1, tmp2, etc.). IBM WebSphere Application Server support should be engaged for further assistance

Cross reference information
Segment Product Component Platform Version Edition
Software Development Rational Application Developer for WebSphere Software -

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere Studio Application Developer
EJB Tools

Software version:

4.0.3, 5.0, 5.0.1, 5.1, 5.1.1, 5.1.2

Operating system(s):

Linux, Windows

Reference #:

1175328

Modified date:

2012-06-28

Translate my page

Machine Translation

Content navigation