Hello all,

I think I can post an XMLBean to a JMS queue, but how to I read it off the JSM
queue from within a MDB?
When I cast the message from the onMessage(Message msg) event to my XMLBEan, I
get a class cast exception.

I want to post some form data to a MDB to kick off some processes.


Here is the code that generates the XML bean and posts it to my jms :

VCALENDARDocument vcaldoc = VCALENDARDocument.Factory.newInstance();
VCALENDAR vcalendar = vcaldoc.addNewVCALENDAR();
VEVENT vevent = vcalendar.addNewVevent();

vcalendar.setProdid(form.getProdid());
vcalendar.setVersion(form.getVersion());
vevent.setDtstart(form.getDtstart());
vevent.setDtend(form.getDtend());
vevent.setSummary(form.getSummary());
vevent.setOrganizer(form.getOrganizer());

appointmentCtrl.sendAppointmentRequest(vcalendar, "12345");


Here the code in the JMS Control:

public interface AppointmentCtrl extends JMSControl,com.bea.control.ControlExtension

{
/**
*
* @jc:jms-property key="accountIdentifier" value="{accountID}"
* @jc:jms-property key="transactionType" value="NOT SUPPORTED"
*
*/
public void sendAppointmentRequest(VCALENDAR vcalendar, String accountID);
static final long serialVersionUID = 1L;
}

Here is how I am trying to read it off the queue in my MDB:

public void onMessage(Message msg)
{

VCALENDAR vcalendar = (VCALENDAR)msg;
System.out.println("Message received");
System.out.println(vcalendar.getProdid());


}

Here the error that i get:

th
rew an Exception in onMessage(). The exception was:
java.lang.ClassCastException.
java.lang.ClassCastException
at mdb.AppointmentEJB.onMessage(AppointmentEJB.java:2 4)
at weblogic.ejb20.internal.MDListener.execute(MDListe ner.java:382)
at weblogic.ejb20.internal.MDListener.transactionalOn Message(MDListener.
java:316)
at weblogic.ejb20.internal.MDListener.onMessage(MDLis tener.java:281)
at weblogic.jms.client.JMSSession.onMessage(JMSSessio n.java:2596)
at weblogic.jms.client.JMSSession.execute(JMSSession. java:2516)
at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:170)
>

th
rew an Exception in onMessage(). The exception was:
java.lang.ClassCastException.
java.lang.ClassCastException
at mdb.AppointmentEJB.onMessage(AppointmentEJB.java:2 4)
at weblogic.ejb20.internal.MDListener.execute(MDListe ner.java:382)
at weblogic.ejb20.internal.MDListener.transactionalOn Message(MDListener.
java:316)
at weblogic.ejb20.internal.MDListener.onMessage(MDLis tener.java:281)
at weblogic.jms.client.JMSSession.onMessage(JMSSessio n.java:2596)
at weblogic.jms.client.JMSSession.execute(JMSSession. java:2516)
at weblogic.kernel.ExecuteThread.execute(ExecuteThrea d.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.ja va:170)
>





Any ideas what it should look like?

Thanks,

Marc