Hello,
I am trying to write a message to a queue from a simple
Java Client using Weblogic Workshop 8.1. The code runs to completion, yet the Admin console shows no messages or bytes received and there is no output from the message bean showing that it received anything.
The client and an MDB are part of the same application,
but are in different projects. The Server log does not show any glowing errors. My code is shown below as fragments. Any help would be greatly appreciated!!!
Thank you,
Ken
MESSAGE BEAN
/**
* @ejbgen:message-driven
* ejb-name = Synch
* destination-jndi-name="SynchQueue"
* destination-type = javax.jms.Queue
*
*/
public class SynchMDBBean extends GenericMessageDrivenBean implements MessageDrivenBean, MessageListener
{
public void onMessage(Message msg) {
System.out.println("Synch queue got message");
}
}
CLIENT CODE (getInitialContext shown below)
Context ic = getInitialContext("t3://localhost:7001", "weblogic", "weblogic");
//factory = (QueueConnectionFactory) ic.lookup("java:comp/env/jms/QueueConnectionFactory");
factory = (QueueConnectionFactory) ic.lookup("weblogic.jws.jms.QueueConnectionFactory");
queue = (Queue) ic.lookup("SynchQueue");
transaction t = new orders(11111111,"YA","YA","SB","EEE","0001","TA26",1,1,1000,1000,
0,1,"28.23","0","0",1,0,500);
QueueConnection connect = factory.createQueueConnection();
QueueSession session = connect.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);
ObjectMessage message = null;
message = session.createObjectMessage(t);// throws JMSException;
sender.send(message);
static Context getInitialContext(
String url, String user, String password) {
InitialContext p =null;
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
//h.put(Context.SECURITY_PRINCIPAL, user);
// h.put(Context.SECURITY_CREDENTIALS, password);