You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Manu George <ma...@gmail.com> on 2007/06/19 08:19:12 UTC
Re: [CONF] OpenEJB: JNDI Names (page edited)
Cool Feature. There was some confusion among users about the JNDI names.
Hopefully this document will clear the doubts.
Regards
Manu
On 6/19/07, confluence@apache.org <co...@apache.org> wrote:
>
> Page Edited : OPENEJB<http://cwiki.apache.org/confluence/display/OPENEJB>: JNDI
> Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI+Names>
>
> JNDI Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI+Names>has been edited by David
> Blevins <http://cwiki.apache.org/confluence/display/%7Edblevins> (Jun 18,
> 2007).
>
> (View changes)<http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=33329&originalVersion=1&revisedVersion=2>
> Content:
> What's My Bean's JNDI Name?
>
> The short answer is:
>
> - {deploymentId}/{interfaceClass.simpleName}
>
> And typically, deploymentId will be your bean's ejb-name unless you've
> explicitly set it to something else via an openejb-jar.xml or set the
> openejb.deploymentId.format<http://cwiki.apache.org/confluence/display/OPENEJB/Deployment+ID>to something else.
>
> So if you have a bean like such:
>
> <session>
> <ejb-name>Calculator</ejb-name>
> <home>org.acme.CalculatorRemoteHome</home>
> <remote>org.acme.CalculatorRemote</remote>
> <local-home>org.acme.CalculatorLocalHome</local-home>
> <local>org.acme.CalculatorLocal</local>
> <ejb-class>org.acme.CalculatorImpl</ejb-class>
> <business-local>org.acme.CalculatorBusinessLocal</business-local>
> <business-local>org.acme.CalculatorBusinessLocalTwo</business-local>
> <business-remote>org.acme.CalculatorBusinessRemote</business-remote>
> <business-remote>org.acme.CalculatorBusinessRemoteTwo</business-remote>
> </session>
>
> The following names will be bound into JNDI and accessible via the
> LocalInitialContextFactory<http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=OPENEJB&title=LocalInitialContextFactory&linkCreation=true&fromPageId=33329>
> :
>
> - Calculator/CalculatorRemote
> - Calculator/CalculatorLocal
> - Calculator/CalculatorBusinessLocal
> - Calculator/CalculatorBusinessLocalTwo
> - Calculator/CalculatorBusinessRemote
> - Calculator/CalculatorBusinessRemoteTwo
>
> And these would be available via the RemoteInitialContextFactory<http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=OPENEJB&title=RemoteInitialContextFactory&linkCreation=true&fromPageId=33329>
>
> - Calculator/CalculatorRemote
> - Calculator/CalculatorBusinessRemote
> - Calculator/CalculatorBusinessRemoteTwo
>
> This is the same list minus any interfaces of a local nature as they
> aren't accessible over a network.
> Changing the JNDI name format
>
> The JNDI name format can actually be changed. At current date this can be
> done on a server-wide basis, but in the future it will be changeable on an
> application and individual bean basis.
>
> To set it for the server, there is a system property called *
> openejb.jndiname.format* which understands the following variables:
>
> - moduleId - typically the file name of the ear or of the ejb jar if
> it's not in an ear.
> - ejbType - STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or
> MESSAGE_DRIVEN
> - ejbClass - ((Class)ejbClass).getName()
> - ejbClass.simpleName - ((Class)ejbClass).getSimpleName());
> - ejbName - ejb-name as it is in the xml
> - deploymentId - the bean's deployment Id
> - interfaceType - EJB_OBJECT, EJB_LOCAL, BUSINESS_LOCAL, or
> BUSINESS_REMOTE
> - interfaceClass - ((Class)interfce).getName()
> - interfaceClass.simpleName - ((Class)interfce).getSimpleName()
>
> More variables will be added in the future, such as prettier varieties of
> ejbType and interfaceType. If there are any you'd like added, feel free to
> write the dev list.
>
> With this you can create a layout for the ejbs in global jndi namespace
> how ever you like. A couple examples could be:
>
> - {interfaceClass.simpleName}
> - {ejbName}{interfaceClass.simpleName}
> - ejb/{interfaceClass.simpleName}
> - ejb/{interfaceClass}
> - {deploymentId}-{interfaceType}
> - app/{moduleId}/ejb/{ejbName}/{interfaceClass}
> - {deploymentId}.{interfaceClass}
>
> You are responsible for ensuring the names don't conflict. I.e. if you
> used something as simple as just "{interfaceClass.simpleName}" as your
> format it would only work as long as you didn't reuse the interface for any
> other beans in your app or any other app deployed in the server. If you used
> "{ejbName}{interfaceClass.simpleName}" you could reuse the interface in
> other beans but you'd have to guarantee that the ejbName is not already used
> by another bean in a different app.
>
> The default of "{deploymentId}/{interfaceClass.simpleName}" is a pretty
> safe bet as deploymentId is guaranteed to be globally unique across all apps
> and beans, however the use of simpleName could cause conflicts if the bean
> had two interfaces like org.package1.Foo and org.package2.Foo. The safest
> bet, though not the default as we wanted something short, is to use the
> fully qualified name of the interface "{deploymentId}/{interfaceClass}".
>
> Powered by Atlassian Confluence<http://www.atlassian.com/software/confluence/default.jsp?clicked=footer>(Version:
> 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request<http://jira.atlassian.com/secure/BrowseProject.jspa?id=10470>
>
> Unsubscribe or edit your notifications preferences<http://cwiki.apache.org/confluence/users/viewnotifications.action>
>
>
Re: [CONF] OpenEJB: JNDI Names (page edited)
Posted by Karan Malhi <ka...@gmail.com>.
This is very helpful indeed. I am working on some stuff for documentation.
On 6/19/07, David Blevins <da...@visi.com> wrote:
>
> On Jun 18, 2007, at 11:19 PM, Manu George wrote:
>
> > Cool Feature. There was some confusion among users about the JNDI
> > names.
> > Hopefully this document will clear the doubts.
>
> Yea, this is one of a few essential documents we need. We soooo need
> a user or two to complain loudly on the information they can't
> find :) Will be a big help. Truth be told, nearly all the
> documentation we have came from answers on the lists.
>
> -David
>
> > Regards
> > Manu
> >
> > On 6/19/07, confluence@apache.org <co...@apache.org> wrote:
> >>
> >> Page Edited : OPENEJB<http://cwiki.apache.org/confluence/
> >> display/OPENEJB>: JNDI
> >> Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI+Names>
> >>
> >> JNDI Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI
> >> +Names>has been edited by David
> >> Blevins <http://cwiki.apache.org/confluence/display/%7Edblevins>
> >> (Jun 18,
> >> 2007).
> >>
> >> (View changes)<http://cwiki.apache.org/confluence/pages/
> >> diffpagesbyversion.action?
> >> pageId=33329&originalVersion=1&revisedVersion=2>
> >> Content:
> >> What's My Bean's JNDI Name?
> >>
> >> The short answer is:
> >>
> >> - {deploymentId}/{interfaceClass.simpleName}
> >>
> >> And typically, deploymentId will be your bean's ejb-name unless
> >> you've
> >> explicitly set it to something else via an openejb-jar.xml or set the
> >> openejb.deploymentId.format<http://cwiki.apache.org/confluence/
> >> display/OPENEJB/Deployment+ID>to something else.
> >>
> >> So if you have a bean like such:
> >>
> >> <session>
> >> <ejb-name>Calculator</ejb-name>
> >> <home>org.acme.CalculatorRemoteHome</home>
> >> <remote>org.acme.CalculatorRemote</remote>
> >> <local-home>org.acme.CalculatorLocalHome</local-home>
> >> <local>org.acme.CalculatorLocal</local>
> >> <ejb-class>org.acme.CalculatorImpl</ejb-class>
> >> <business-local>org.acme.CalculatorBusinessLocal</business-
> >> local>
> >> <business-local>org.acme.CalculatorBusinessLocalTwo</
> >> business-local>
> >> <business-remote>org.acme.CalculatorBusinessRemote</business-
> >> remote>
> >> <business-remote>org.acme.CalculatorBusinessRemoteTwo</
> >> business-remote>
> >> </session>
> >>
> >> The following names will be bound into JNDI and accessible via the
> >> LocalInitialContextFactory<http://cwiki.apache.org/confluence/
> >> pages/createpage.action?
> >> spaceKey=OPENEJB&title=LocalInitialContextFactory&linkCreation=true&f
> >> romPageId=33329>
> >> :
> >>
> >> - Calculator/CalculatorRemote
> >> - Calculator/CalculatorLocal
> >> - Calculator/CalculatorBusinessLocal
> >> - Calculator/CalculatorBusinessLocalTwo
> >> - Calculator/CalculatorBusinessRemote
> >> - Calculator/CalculatorBusinessRemoteTwo
> >>
> >> And these would be available via the
> >> RemoteInitialContextFactory<http://cwiki.apache.org/confluence/
> >> pages/createpage.action?
> >> spaceKey=OPENEJB&title=RemoteInitialContextFactory&linkCreation=true&
> >> fromPageId=33329>
> >>
> >> - Calculator/CalculatorRemote
> >> - Calculator/CalculatorBusinessRemote
> >> - Calculator/CalculatorBusinessRemoteTwo
> >>
> >> This is the same list minus any interfaces of a local nature as they
> >> aren't accessible over a network.
> >> Changing the JNDI name format
> >>
> >> The JNDI name format can actually be changed. At current date this
> >> can be
> >> done on a server-wide basis, but in the future it will be
> >> changeable on an
> >> application and individual bean basis.
> >>
> >> To set it for the server, there is a system property called *
> >> openejb.jndiname.format* which understands the following variables:
> >>
> >> - moduleId - typically the file name of the ear or of the ejb
> >> jar if
> >> it's not in an ear.
> >> - ejbType - STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or
> >> MESSAGE_DRIVEN
> >> - ejbClass - ((Class)ejbClass).getName()
> >> - ejbClass.simpleName - ((Class)ejbClass).getSimpleName());
> >> - ejbName - ejb-name as it is in the xml
> >> - deploymentId - the bean's deployment Id
> >> - interfaceType - EJB_OBJECT, EJB_LOCAL, BUSINESS_LOCAL, or
> >> BUSINESS_REMOTE
> >> - interfaceClass - ((Class)interfce).getName()
> >> - interfaceClass.simpleName - ((Class)interfce).getSimpleName()
> >>
> >> More variables will be added in the future, such as prettier
> >> varieties of
> >> ejbType and interfaceType. If there are any you'd like added, feel
> >> free to
> >> write the dev list.
> >>
> >> With this you can create a layout for the ejbs in global jndi
> >> namespace
> >> how ever you like. A couple examples could be:
> >>
> >> - {interfaceClass.simpleName}
> >> - {ejbName}{interfaceClass.simpleName}
> >> - ejb/{interfaceClass.simpleName}
> >> - ejb/{interfaceClass}
> >> - {deploymentId}-{interfaceType}
> >> - app/{moduleId}/ejb/{ejbName}/{interfaceClass}
> >> - {deploymentId}.{interfaceClass}
> >>
> >> You are responsible for ensuring the names don't conflict. I.e. if
> >> you
> >> used something as simple as just "{interfaceClass.simpleName}" as
> >> your
> >> format it would only work as long as you didn't reuse the
> >> interface for any
> >> other beans in your app or any other app deployed in the server.
> >> If you used
> >> "{ejbName}{interfaceClass.simpleName}" you could reuse the
> >> interface in
> >> other beans but you'd have to guarantee that the ejbName is not
> >> already used
> >> by another bean in a different app.
> >>
> >> The default of "{deploymentId}/{interfaceClass.simpleName}" is a
> >> pretty
> >> safe bet as deploymentId is guaranteed to be globally unique
> >> across all apps
> >> and beans, however the use of simpleName could cause conflicts if
> >> the bean
> >> had two interfaces like org.package1.Foo and org.package2.Foo. The
> >> safest
> >> bet, though not the default as we wanted something short, is to
> >> use the
> >> fully qualified name of the interface "{deploymentId}/
> >> {interfaceClass}".
> >>
> >> Powered by Atlassian Confluence<http://www.atlassian.com/
> >> software/confluence/default.jsp?clicked=footer>(Version:
> >> 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request<http://
> >> jira.atlassian.com/secure/BrowseProject.jspa?id=10470>
> >>
> >> Unsubscribe or edit your notifications preferences<http://
> >> cwiki.apache.org/confluence/users/viewnotifications.action>
> >>
> >>
>
>
--
Karan Malhi
Re: [CONF] OpenEJB: JNDI Names (page edited)
Posted by David Blevins <da...@visi.com>.
On Jun 18, 2007, at 11:19 PM, Manu George wrote:
> Cool Feature. There was some confusion among users about the JNDI
> names.
> Hopefully this document will clear the doubts.
Yea, this is one of a few essential documents we need. We soooo need
a user or two to complain loudly on the information they can't
find :) Will be a big help. Truth be told, nearly all the
documentation we have came from answers on the lists.
-David
> Regards
> Manu
>
> On 6/19/07, confluence@apache.org <co...@apache.org> wrote:
>>
>> Page Edited : OPENEJB<http://cwiki.apache.org/confluence/
>> display/OPENEJB>: JNDI
>> Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI+Names>
>>
>> JNDI Names <http://cwiki.apache.org/confluence/display/OPENEJB/JNDI
>> +Names>has been edited by David
>> Blevins <http://cwiki.apache.org/confluence/display/%7Edblevins>
>> (Jun 18,
>> 2007).
>>
>> (View changes)<http://cwiki.apache.org/confluence/pages/
>> diffpagesbyversion.action?
>> pageId=33329&originalVersion=1&revisedVersion=2>
>> Content:
>> What's My Bean's JNDI Name?
>>
>> The short answer is:
>>
>> - {deploymentId}/{interfaceClass.simpleName}
>>
>> And typically, deploymentId will be your bean's ejb-name unless
>> you've
>> explicitly set it to something else via an openejb-jar.xml or set the
>> openejb.deploymentId.format<http://cwiki.apache.org/confluence/
>> display/OPENEJB/Deployment+ID>to something else.
>>
>> So if you have a bean like such:
>>
>> <session>
>> <ejb-name>Calculator</ejb-name>
>> <home>org.acme.CalculatorRemoteHome</home>
>> <remote>org.acme.CalculatorRemote</remote>
>> <local-home>org.acme.CalculatorLocalHome</local-home>
>> <local>org.acme.CalculatorLocal</local>
>> <ejb-class>org.acme.CalculatorImpl</ejb-class>
>> <business-local>org.acme.CalculatorBusinessLocal</business-
>> local>
>> <business-local>org.acme.CalculatorBusinessLocalTwo</
>> business-local>
>> <business-remote>org.acme.CalculatorBusinessRemote</business-
>> remote>
>> <business-remote>org.acme.CalculatorBusinessRemoteTwo</
>> business-remote>
>> </session>
>>
>> The following names will be bound into JNDI and accessible via the
>> LocalInitialContextFactory<http://cwiki.apache.org/confluence/
>> pages/createpage.action?
>> spaceKey=OPENEJB&title=LocalInitialContextFactory&linkCreation=true&f
>> romPageId=33329>
>> :
>>
>> - Calculator/CalculatorRemote
>> - Calculator/CalculatorLocal
>> - Calculator/CalculatorBusinessLocal
>> - Calculator/CalculatorBusinessLocalTwo
>> - Calculator/CalculatorBusinessRemote
>> - Calculator/CalculatorBusinessRemoteTwo
>>
>> And these would be available via the
>> RemoteInitialContextFactory<http://cwiki.apache.org/confluence/
>> pages/createpage.action?
>> spaceKey=OPENEJB&title=RemoteInitialContextFactory&linkCreation=true&
>> fromPageId=33329>
>>
>> - Calculator/CalculatorRemote
>> - Calculator/CalculatorBusinessRemote
>> - Calculator/CalculatorBusinessRemoteTwo
>>
>> This is the same list minus any interfaces of a local nature as they
>> aren't accessible over a network.
>> Changing the JNDI name format
>>
>> The JNDI name format can actually be changed. At current date this
>> can be
>> done on a server-wide basis, but in the future it will be
>> changeable on an
>> application and individual bean basis.
>>
>> To set it for the server, there is a system property called *
>> openejb.jndiname.format* which understands the following variables:
>>
>> - moduleId - typically the file name of the ear or of the ejb
>> jar if
>> it's not in an ear.
>> - ejbType - STATEFUL, STATELESS, BMP_ENTITY, CMP_ENTITY, or
>> MESSAGE_DRIVEN
>> - ejbClass - ((Class)ejbClass).getName()
>> - ejbClass.simpleName - ((Class)ejbClass).getSimpleName());
>> - ejbName - ejb-name as it is in the xml
>> - deploymentId - the bean's deployment Id
>> - interfaceType - EJB_OBJECT, EJB_LOCAL, BUSINESS_LOCAL, or
>> BUSINESS_REMOTE
>> - interfaceClass - ((Class)interfce).getName()
>> - interfaceClass.simpleName - ((Class)interfce).getSimpleName()
>>
>> More variables will be added in the future, such as prettier
>> varieties of
>> ejbType and interfaceType. If there are any you'd like added, feel
>> free to
>> write the dev list.
>>
>> With this you can create a layout for the ejbs in global jndi
>> namespace
>> how ever you like. A couple examples could be:
>>
>> - {interfaceClass.simpleName}
>> - {ejbName}{interfaceClass.simpleName}
>> - ejb/{interfaceClass.simpleName}
>> - ejb/{interfaceClass}
>> - {deploymentId}-{interfaceType}
>> - app/{moduleId}/ejb/{ejbName}/{interfaceClass}
>> - {deploymentId}.{interfaceClass}
>>
>> You are responsible for ensuring the names don't conflict. I.e. if
>> you
>> used something as simple as just "{interfaceClass.simpleName}" as
>> your
>> format it would only work as long as you didn't reuse the
>> interface for any
>> other beans in your app or any other app deployed in the server.
>> If you used
>> "{ejbName}{interfaceClass.simpleName}" you could reuse the
>> interface in
>> other beans but you'd have to guarantee that the ejbName is not
>> already used
>> by another bean in a different app.
>>
>> The default of "{deploymentId}/{interfaceClass.simpleName}" is a
>> pretty
>> safe bet as deploymentId is guaranteed to be globally unique
>> across all apps
>> and beans, however the use of simpleName could cause conflicts if
>> the bean
>> had two interfaces like org.package1.Foo and org.package2.Foo. The
>> safest
>> bet, though not the default as we wanted something short, is to
>> use the
>> fully qualified name of the interface "{deploymentId}/
>> {interfaceClass}".
>>
>> Powered by Atlassian Confluence<http://www.atlassian.com/
>> software/confluence/default.jsp?clicked=footer>(Version:
>> 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request<http://
>> jira.atlassian.com/secure/BrowseProject.jspa?id=10470>
>>
>> Unsubscribe or edit your notifications preferences<http://
>> cwiki.apache.org/confluence/users/viewnotifications.action>
>>
>>