Thanks very much. A few clarifications:
1. What exactly do you mean by "the same application"? The same EAR file?
2. @EJB isn't an option as the MDB will have no idea what the target session beans are when it is written.
So, putting everything together, I think I would have to:
a) Package the MDB and the target EJB(s) into 1 EAR file.
b) Write an ejb-jar.xml file for this EAR, listing each referenced EJB in the MDB's descriptor, like below.
This deployment-time coupling is undesirable but I guess it's the price you pay for the performance gain of using the local interface.
<ejb-jar ...>
<enterprise-beans>
<message-driven>
<ejb-name>MessageBean</ejb-name>
<ejb-class>com.example.MessageBean</ejb-class>
<messaging-type>com.example.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/SessionLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.example.SessionLocalHome</local-home>
<local>com.example.SessionLocal</local>
<ejb-link>SessionBean</ejb-link>
</ejb-local-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
[Message sent by forum member 'matterbury' (matterbury)]
http://forums.java.net/jive/thread.jspa?messageID=321104