Posted By:
Aroscham_Montes
Posted On:
Thursday, May 30, 2002 11:31 AM
Hello Everybody!! For the development of our web application were using WAS 4.0.3, Oracle 8.06, Struts 1.0. with session EJBs -1.1- and Java Beans. On of the EJB we fill java beans and store them in a collection. That collection is read in the correspondent Action component. In order to retrieve the objects from the collection we first get the Iterator object of the collection and then, using the Iterator object, we get each object using casting. The code is the next: DataJavaBean dataJavaBean = new DataJavaBean (); // is a Java Bean Collection collection = null; collection = ejb.finderMethod( ); // EJB Finder Method retur
More>>
Hello Everybody!!
For the development of our web application were using WAS 4.0.3, Oracle 8.06, Struts 1.0. with session EJBs -1.1- and Java Beans.
On of the EJB we fill java beans and store them in a collection.
That collection is read in the correspondent Action component. In order to retrieve the objects from the collection we first get the Iterator object of the collection and then, using the Iterator object, we get each object using casting. The code is the next:
DataJavaBean dataJavaBean = new DataJavaBean (); // is a Java Bean
Collection collection = null;
collection = ejb.finderMethod( ); // EJB Finder Method returns a collection
Iterator iterator = collection.iterator(); // here I get the iterator object
/* Use of the iterator object */
if ( iterator.hasNext() ) {
dataJavaBean = (DataJavaBean) iterator.next(); // this is the line 146
}
We have tested this application on Weblogic 6.1 and found no problems.
But in Websphere the next exception is trown by the application:
X Servlet Error: com.beans.ProductoBean: java.lang.ClassCastException: com.beans.ProductoBean
at com..struts.actions.DetalleProductoAction.doPerform(DetalleProductoAction.java:146)
Any ideas on why is the reason this exception is thrown?
How can we solve this trouble?
Thanks everybody!!
<<Less