I've setup GenericJMS RA on Glassfish V2 (50g, 52, 54 and V1) and am
having some trouble getting Message-Driven Beans working properly with
my Tibco EMS installation.
If I write a servlet and use InitialContext to lookup the
ConnectionFactories and Queues it works just fine. If I write a very
simple MDB like below I am unable to deploy.
[#|2007-07-19T13:34:29.851-0700|SEVERE|sun-appserver9.1|
javax.enterprise.system.container.ejb.mdb|
_ThreadID=20;_ThreadName=Thread-32;_Re
questID=a9b37999-46cd-4181-8cb1-b515f54f6a85;|
com.sun.enterprise.connectors.ConnectorRuntimeException
com.sun.enterprise.connectors.ConnectorRuntimeException: Could not find
physical destination : null
at
com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.getPhysicalDestinationFromConfiguration(ActiveJmsResourceAdapte
r.java:1415)
at
com.sun.enterprise.connectors.system.ActiveJmsResourceAdapter.updateMDBRuntimeInfo(ActiveJmsResourceAdapter.java:1253)
at
com.sun.enterprise.connectors.inflow.ConnectorMessageBeanClient.setup(ConnectorMessageBeanClient.java:170)
at
com.sun.ejb.containers.MessageBeanContainer.<init>(MessageBeanContainer.java:209)
...
Too me, it looks like it might be looking for my EMS Queue in the
system's Sun JMS System and hence the null physical destination. I
suppose that brings up a conceptual problem with descriptor-less MDBs.
How would you specify which connection factory to use?
Doesn't work (with exception above on deployment):
@MessageDriven(mappedName="jms/MyQueue")
public class LogJMS implements MessageListener {
@Resource
private MessageDrivenContext mdc;
public void onMessage(Message in) {
TextMessage msg = null;
try {
if (in instanceof TextMessage) {
msg = (TextMessage) in;
System.out.println(in);
} else {
System.out.println("Message of wrong type: "
+ in.getClass().getName());
}
} catch (JMSException e) {
e.printStackTrace();
mdc.setRollbackOnly();
} catch (Throwable te) {
te.printStackTrace();
}
}
}
Works fine:
InitialContext initCtx = new InitialContext();
Queue bar = (Queue) initCtx.lookup("jms/MyQueue");
QueueConnectionFactory qf = (QueueConnectionFactory) initCtx
.lookup("jms/tibemsQueueConnectionFactory");
QueueConnection c = qf.createQueueConnection();
QueueSession s = c.createQueueSession(false,
javax.jms.Session.AUTO_ACKNOWLEDGE);
QueueReceiver r = s.createReceiver(bar);
c.start();
Message m = r.receive(10000l);
System.out.println(m);
s.close();
c.close();
Thanks
________________________________________________________________________
Richard "Trey" Hyde
Lead Software Engineer, CNET Channel
Richard.Hyde_at_cnet.com