Hi,
I have a problem with JBoss-2.4.4_Tomcat-4.0.1:
I have a stateless session bean that sends a receive simple java object using jms Queue (see remote interface below). I use jsps and servlets to call those business methods for sending and receiving a simple serializable object (Stock). The bean was able to send and receive the object correctly, however when I try to use the Stock object in my jsp, I get a ClassCastException. The jsp that I have simply prints out the class name of the object I received from the bean (which actually showed the it had received a Stock object), and then try to cast it to a Stock object (see listing below) but this failed.
I deployed my application as a .ear (with the session bean packaged as a .jar, and the webapp as a .war). Both the .jar and .war file contains references to the Stock.class.
Thanks ...
Sarom
----------------------------------
public interface QueuePublisher extends EJBObject{
public void send(java.io.Serializable object)throws RemoteException;
public Collection receive() throws RemoteException;
}
---------------
public class Stock implements java.io.Serializable{
String _symbol = null;
String _name = null;
float _price;
public Stock(){}
public Stock(String symbol, String name){
_symbol = symbol;
_name = name;
}
public String getSymbol(){ return _symbol; }
public String getName(){ return _name; }
public float getPrice(){ return _price; }
public void setSymbol(String symbol){ _symbol = symbol; }
public void setName(String name){ _name = name;}
public void setPrice(float price){ _price = price; }
}
-----------
my jsp
.
.
<%
for(Iterator iterator = quotes.iterator(); iterator.hasNext(); ){
Object object = iterator.next();
if(object!=null){
out.print("Class: " + object.getClass().getName());
Stock stock = (Stock)object;
}
}
%>