<strong>Problems with iterator in WebSphere 4.0.3</strong>
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aroscham_Montes
Posted On:   Thursday, May 30, 2002 11:31 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’s -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 we’re using WAS 4.0.3, Oracle 8.06, Struts 1.0. with session EJB’s -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: <strong>Problems with iterator in WebSphere 4.0.3</strong>

Posted By:   Deltagh_Hakim  
Posted On:   Friday, July 12, 2002 03:39 AM



I do not have readymade ans, but could you please check the

class type of the object returned by iterator.next(),

I mean print the information iterator.next().getClass().getName(),

it may be helpfull to you for narrow down the actual problem.



Re: <strong>Problems with iterator in WebSphere 4.0.3</strong>

Posted By:   Anonymous  
Posted On:   Thursday, May 30, 2002 04:28 PM

Well, quite easy. You should run your app in 'Application mode'.
Please make one changes in the WebSphere Admin console.
About | Sitemap | Contact