users@glassfish.java.net

How to access local interface from MDB?

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Dec 2008 11:03:12 PST

Hi,

This is not glassfish-specific (AFAIK) but I'm using GF to implement this, and hopefully someone here has some ideas :-)

I am writing an MDB (driven by a JCA RA) that needs to invoke any named method on any named session bean.

I have the RA and MDB working fine (as far as I can tell :-)), and the MDB can create a remote object given the JNDI name of the remote home.

However, I cannot work out how to access the target bean's [b]local home[/b] given its name. I can access its remote home using JNDI and can successfully create a remote object, but I would prefer to use the local interface for performance reasons. And I use those terms deliberately because I need to be able to support accessing EJB 2.1 session beans.

I have tried a number of things:
* Using JNDI. My understanding from the GF EJB FAQ is that LocalHome's do not (in fact, cannot) have JNDI names so cannot be accessed via JNDI. I have had no success so I tend to believe this.
* Using simple "class.forName()". No joy - the loader cannot find the named class.
* Trying ejb-local-ref's. I have been unable to get this right.

Note that because it will be "any named session bean", I have deployed the MDB separately from any of the target session beans. This is desirable but not mandatory: if the only way to do it is deploy them together then that is acceptable, but exactly what needs to be done?

My setup is: glassfish-v2ur1, target EJB deployed, my RA deployed, my MDB deployed.
Everything is being developed in NB6.1. The RA is copied into the autodeploy directory because NB doesn't know how to deploy it, but the EJB and MDB are deployed from NB.

I deliberately haven't listed errors because I first need to know if this is even doable in EJB and/or GF, and initially I just (?) needs some ideas on how to do this ... I am happy to search/read further but at the moment I have tried everything I can think of.

Many thanks for any and all suggestions!
[Message sent by forum member 'matterbury' (matterbury)]

http://forums.java.net/jive/thread.jspa?messageID=321093