tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: InitialContext JNDI Lookup
Date Fri, 23 Feb 2007 02:57:49 GMT

On Feb 22, 2007, at 7:05 AM, Marco Mistroni wrote:

> Hi,
>  i have deployed EJB3 in jboss (not sure if it matters but it might  
> give
> you an idea)
>
> some time (while spec was evolving), my lookup was
> nameOfYourEarFile/nameOfYourBean

That's also the format used by Geronimo's integration of OpenEJB.   
IIRC, though it may be nameOfYourJarFile/nameOfYourBean.

Definitely an area we need to document better.  The rules are  
currently as such (all that is not yet configurable will be soon  
enough):

JNDI names that clients use are not yet configurable as such,  
strictly, but are based in the deployment-id of your bean, which is  
the unique id of the bean in the system.  The deployment-id is  
configurable and even the default deployment-id is configurable.

The default deployment-id format is set with a system property called  
"openejb.deploymentId.format".  The OpenEJB embedded and standalone,  
it's currently set to "{ejbName}".  Geronimo has it set to  
"{moduleId}/{ejbName}".  A few input choices are available:

appId       == new File(earFilePath).getName()
moduleId    == new File(jarPath).getName()
ejbClass    == bean.getClass().getName()
ejbClass.simpleName == bean.getClass().getSimpleName()
ejbName     == bean.getEjbName()

So you can really take control of how those names are set.

Now, the JNDI names themselves will soon have the above formatting  
functionality, but currently they are hard coded to be:

             switch (ejbInterfaceType) {
                 case REMOTE_HOME:
                     return deploymentId;
                 case LOCAL_HOME:
                     return deploymentId + "Local";
                 case BUSINESS_LOCAL:
                     return deploymentId + "BusinessLocal";
                 case BUSINESS_REMOTE:
                     return deploymentId + "BusinessRemote";
             }

Hope that helps!

-David


> or try to use just the name of your bean as you specify it with name
> attribute of your annotation..
>
> hth
> marco
>
> On 2/22/07, Mohammad Nour El-Din <nour.mohammad@gmail.com> wrote:
>>
>> Hi Tom...
>>
>> What combinations you have used ? does this EJB supports EJB2.1  
>> home and
>> object interfaces or EJB3.0 business interface(s) ?
>>
>>
>>
>> On 2/22/07, Tom Purcell <tpurcell@chariotsolutions.com> wrote:
>>
>> >
>> > Hello
>> >
>> > I have created an EJB3 stateless session bean using annotations (no
>> > deployment descriptors) and packed it into a jar and packed the  
>> jar into
>> > an
>> > ear (there is no web app yet and, therefore, no war). The ear
>> successfully
>> > deploys to a Geronimo/Tomcat 2.0-M2 server.
>> >
>> > The problem I'm having is in the lookup from my client. I'm new to
>> OpenEJB
>> > and Geronimo but not to EJB. I'm setting properties, giving them  
>> to the
>> > InitialContext and doing a lookup. But a lookup on what? What is  
>> the
>> > format
>> > for the JNDI name I wnat to find? I've tried a number of  
>> combinations
>> with
>> > no luck.
>> >
>> > Thanks
>> > Tom
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/InitialContext-JNDI-Lookup- 
>> tf3273209s2756.html#a9101357
>> > Sent from the OpenEJB User mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Thanks
>> - Mohammad Nour
>>


Mime
View raw message