I'm using MDB's on WebLogic6.0 with sp2. I'm using Pub/Sub. I tried
using TextMessage it works fine but I try to use ObjectMessage I get the
following error.
<Jun 18, 2001 7:44:09 AM CDT> <Warning> <EJB> <The MessageDrivenBean
threw an Exception in onMessage()
java.lang.ClassCastException: weblogic.jms.common.TextMessageImpl
at
com.nextjet.enterprise.flightmonitoring.flightcancellation.FlightCancellationMDB.onMessage(FlightCancellationMDB.java:71)
at
weblogic.ejb20.internal.MDListener.execute(MDListener.java:221)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
Here's my code on the Pub side
topicConnectionFactory =
(TopicConnectionFactory)_ctx.lookup(JMS_FACTORY);
topicConnection =
topicConnectionFactory.createTopicConnection();
topicSession = topicConnection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
try {
topic = (Topic) _ctx.lookup(_topic_name);
}
catch(NamingException ne) {
topic = topicSession.createTopic(_topic_name);
_ctx.bind(_topic_name, topic);
}
topicPublisher = topicSession.createPublisher(topic);
msg = topicSession.createObjectMessage();
// Start the JMS connection; allows messages to be delivered.
topicConnection.start();
FlightID flightID = new FlightID(new Date(), "AA", "", null, "DFW",
"ATL");
FlightCancellation flightCancellation = new FlightCancellation(flightID,
new Date());
msg.setObject(flightCancellation);
topicPublisher.publish(msg);
}
Can somebody tell me why I get a class cast exception and why it's
looking for weblogic.jms.common.TextMessageImpl
Thanks
Sameera
-Don
Here's the code for onMessage
public void onMessage(Message message) {
try {
if(message instanceof ObjectMessage)
System.out.println("Message is ObjectMessage");
System.out.println("Inside onMessage");
ObjectMessage objectmessage = (ObjectMessage)message;
FlightCancellation flightcancellation = (FlightCancellation)objectmessage.getObject();
}
catch(Exception e) {
}
}
Thanks
Sameera
if (message instanceof ObjectMessage) {
FlightCancellation fc = (FlightCancellation)
((ObjectMessage) message).getObject();
}
I don't see you setting the delivery mode on your producer. The default is
persistent. Perhaps you have some TextMessages still in your queue from
a previous test run?.
_sjz.
"Sameera Balay" <s...@nextjet.com> wrote in message
news:3B2E0951...@nextjet.com...
Thanks
Sameera