dcsimg
<br>A problem with iterator <br>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aroscham_Montes
Posted On:   Thursday, May 30, 2002 11:13 AM

Hello Everybody!! For the development of our web application we’re using WAS 4.0.3, Oracle 8.06, Struts 1.0. with session EJB-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    More>>

Hello Everybody!!



For the development of our web application we’re using WAS 4.0.3, Oracle 8.06, Struts 1.0. with session EJB-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

Re: <br>A problem with iterator <br>

Posted By:   Les_Jones  
Posted On:   Thursday, June 6, 2002 10:57 AM

This is a class loader problem. The quickes simplest way would be to set your class loader visibility to Application.
About | Sitemap | Contact