First, I can't think of a good reason why you'd want to look up an MDB, those are supposed to be invoked by the container only (by the JMS implementation to be precise), but if you're trying to look up a JMS publisher or connection then what your asking for totally makes sense.
With that said, JBoss 7 introduced a nice new feature, the Remote Naming Project does exactly what you need, the problem is that, apparently, it is only able to bind remote EJBs, you could give it a try though. It is my personal opinion that the JBoss team (to whom I'm infinitely thankful for such a great work) is a little left behind in this (maybe they have a good reason for it?), other JEE containers have been able to do this for quite a while, in Weblogic it's called Foreign JNDI Binding, but anyway, if the above didn't work and you absolutely need to do this, I'm afraid the only solution left is to do it programmatically, in that case keep reading below.
The javax.naming
API provides a way to bind references to objects outside your local naming context, simply use InitialContext.bind(String name, Object obj), but instead of binding the actual object bind an instance of javax.naming.Reference. As you can see from the javadocs, to create the Reference instance you need to provide an instance of an implementation of javax.naming.RefAddr containing the necessary info to locate the remote object and an implementation of javax.naming.spi.ObjectFactory which is the object that under the hood will do the actual look up to get your remote object. It'd look something like this:
InitialContext ctx = new InitialContext();
ForeignJNDIObjectRefAddr refAddr = getRemoteObjectJNDIInfo(...;
ctx.bind("jms/Server", new Reference("java.lang.Object",
refAddr, ForeignJNDIObjectFactory.class.getName(), null));
in this case you would have implemented ForeignJNDIObjectRefAddr
and ForeignJNDIObjectFactory
, when it's time to do the look up, your ForeignJNDIObjectFactory.getObjectInstance
method will get invoked with the ForeignJNDIObjectRefAddr
instance as its first parameter, so that you have all the necessary info to do the look up and return your remote object. good luck!