users@glassfish.java.net

Define jndi-name outside of ejb-jar

From: <glassfish_at_javadesktop.org>
Date: Wed, 10 Dec 2008 17:56:10 PST

Dear Friends,

Is there any way to define the JNDI name of a session bean outside the ejb-jar?

I will explain. Please tell me if I'm insane:

My company is developing an EJB3-based application that is accessed from a standalone client using JNDI. It already works like a charm.

We have a number of ejb-jars: customers.jar, inventory.jar, accounting.jar, etc.

We want to deploy these unmodified ejb-jars in many different EARs inside the same domain. We already managed to move the Persistence Unit from the ejb-jar to the EAR so that the database settings are EAR-wide now (ie. inventory.jar now accesses different databases in each EAR).

But we didn't find a solution to configure the jndi-name of the beans at EAR level. Whatever we put in "jndi-name" in sun-ejb-jar.xml, will be repeated across EARs (because the ejb-jars are unmodified). There will be JNDI name clashes and we are doomed. The client would not know how to connect to this specific instance of InventoryManagerRemote that lies inside AcmeApplication.EAR.

We want to define a "prefix" for JNDI names inside each EAR. If necessary, we are willing to set jndi-name for every single EJB inside the EAR. The client's login dialog will ask for this prefix (alongside the server name, port, user name, password...), so when resolving a bean, the client would use that prefix.

Any ideas?

Thanks in advance!

Fabio Gomes de Souza
[Message sent by forum member 'fabiofb' (fabiofb)]

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