You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Ryan <ry...@vacode.com> on 2007/02/22 10:46:08 UTC

Is there a vendor independent way of accessing EJBs from a standalone client?

Hi,

I'm working at setting up an application client and am having some
difficulty accessing EJBs on the server.  I'm running my client using an
application client container and am trying it out on a few different
application servers.

However, I'm having difficulty finding a way to lookup EJBs in a vendor
independent manner.  Specifically, almost every doc I can find has some
variation of:

Context initialContext = new InitialContext();
Object ref = initialContext.lookup("some vendor specific name here");

If I replace "some vendor specific name here" with the proper vendor
specific name for each app server and re-deploy everything works.

At first I thought I could use application-client.xml to name each EJB
and have the container(s) take care of the mapping, but I haven't had
any luck with this approach.  I tried something like this (relevant
parts only):

<ejb-ref>
	<ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
	<ejb-ref-type>Session</ejb-ref-type>
	<remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
</ejb-ref>

When I deploy to Glassfish using the above I end up with a JNDI name of
"ejb/test1234/ConnectionTester" and can look it up using
"java:comp/env/ejb/test1234/ConnectionTester".

However, when I try to deploy to Geronimo, I get the following error
(while deploying):

org.apache.openejb.OpenEJBException: Cannot find bean
"ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".

Obviously I'm missing something because Glassfish appears to use
'ejb-ref-name' as a type of alias for the EJB name while Geronimo thinks
it contains the name of an existing EJB.

Maybe I'm just not thinking clearly tonight, but isn't there some kind
of simple, standard way of looking up an EJB from a standalone client?
Is vendor independence even a realistic goal (that's what the spec is
for right)?

Thanks in advance for any help,
Ryan

P.S.  Sorry for the formatting :-(


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by Dain Sundstrom <da...@iq80.com>.
I didn't realize he was using an appclient.  In that case, he doesn't  
really need to abstract.  Then again, I personally don't like the  
appclient model.  It helps make resource lookups portable, but for  
that small feature, you must client code must be processed by the app  
server.  Meaning, that any updates to the client have to be  
"deployed" to the server.  Then you must use a vendor specific  
technology to distribute the app clients to your users.  Also, you  
are limited to the execution model your vendor supports.  For  
example, Geronimo only supports standalone vm appclients.  What if  
you wanted to use an applet or web-start?

I think it was a nice try, but I wouldn't rely on it.

Just my opinion,

-dain


On Feb 23, 2007, at 9:22 AM, David Jencks wrote:

>
> On Feb 23, 2007, at 7:26 AM, Dain Sundstrom wrote:
>
>> I suggest you put an interface in that abstracts the lookups.   
>> This will let your code easily switch between vendors.
>
> Why would he want to do that?  He's using a javaee app client  
> container, so the spec says how to get to an ejb in the same ear in  
> a standard way.  On a spec compliant server it will just work.
>
> thanks
> david jencks
>
>>
>> -dain
>>
>> On Feb 22, 2007, at 3:13 PM, Ryan wrote:
>>
>>> You're right, I didn't quite explain things 100%.  I would like  
>>> to have
>>> a .ear file that contains EJBs and a Swing client.  I would like  
>>> to be
>>> able to deploy that .ear and have it work on Glassfish or  
>>> Geronimo, but
>>> don't want to change naming lookups, etc.
>>>
>>> I really just want to have the option of switching vendors at a  
>>> later
>>> date.  I will always use a matching app server and client  
>>> container (ie:
>>> Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).
>>>
>>> Ryan
>>>
>>>
>>> Jencks wrote:
>>>> I'm unclear on whether you plan to run the app client on the same
>>>> vendors product as the ejb itself.
>>>>
>>>> If you plan to use  2 vendors you have to use corba.
>>>>
>>>> If you plan to use the app client container and the ejb  
>>>> container from
>>>> geronimo, what you are trying should work.  However for geronimo  
>>>> you
>>>> would have to have deployed the ejb application first (assuming  
>>>> it is
>>>> not packaged in an ear with the app client) and the ejb app  
>>>> would have
>>>> to be a parent of the client app.  Under these circumstances the
>>>> deployers should be able to find your ejb at deploy time and  
>>>> figure out
>>>> how to hook up to it when you run the app client.
>>>>
>>>> thanks
>>>> david jencks
>>>>
>>>> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm working at setting up an application client and am having some
>>>>> difficulty accessing EJBs on the server.  I'm running my client  
>>>>> using an
>>>>> application client container and am trying it out on a few  
>>>>> different
>>>>> application servers.
>>>>>
>>>>> However, I'm having difficulty finding a way to lookup EJBs in  
>>>>> a vendor
>>>>> independent manner.  Specifically, almost every doc I can find  
>>>>> has some
>>>>> variation of:
>>>>>
>>>>> Context initialContext = new InitialContext();
>>>>> Object ref = initialContext.lookup("some vendor specific name  
>>>>> here");
>>>>>
>>>>> If I replace "some vendor specific name here" with the proper  
>>>>> vendor
>>>>> specific name for each app server and re-deploy everything works.
>>>>>
>>>>> At first I thought I could use application-client.xml to name  
>>>>> each EJB
>>>>> and have the container(s) take care of the mapping, but I  
>>>>> haven't had
>>>>> any luck with this approach.  I tried something like this  
>>>>> (relevant
>>>>> parts only):
>>>>>
>>>>> <ejb-ref>
>>>>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>>>>     <ejb-ref-type>Session</ejb-ref-type>
>>>>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>>>>> </ejb-ref>
>>>>>
>>>>> When I deploy to Glassfish using the above I end up with a JNDI  
>>>>> name of
>>>>> "ejb/test1234/ConnectionTester" and can look it up using
>>>>> "java:comp/env/ejb/test1234/ConnectionTester".
>>>>>
>>>>> However, when I try to deploy to Geronimo, I get the following  
>>>>> error
>>>>> (while deploying):
>>>>>
>>>>> org.apache.openejb.OpenEJBException: Cannot find bean
>>>>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>>>>
>>>>> Obviously I'm missing something because Glassfish appears to use
>>>>> 'ejb-ref-name' as a type of alias for the EJB name while  
>>>>> Geronimo thinks
>>>>> it contains the name of an existing EJB.
>>>>>
>>>>> Maybe I'm just not thinking clearly tonight, but isn't there  
>>>>> some kind
>>>>> of simple, standard way of looking up an EJB from a standalone  
>>>>> client?
>>>>> Is vendor independence even a realistic goal (that's what the  
>>>>> spec is
>>>>> for right)?
>>>>>
>>>>> Thanks in advance for any help,
>>>>> Ryan
>>>>>
>>>>> P.S.  Sorry for the formatting :-(
>>>>>
>>>>
>>>
>>
>


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by David Jencks <da...@yahoo.com>.
On Feb 23, 2007, at 7:26 AM, Dain Sundstrom wrote:

> I suggest you put an interface in that abstracts the lookups.  This  
> will let your code easily switch between vendors.

Why would he want to do that?  He's using a javaee app client  
container, so the spec says how to get to an ejb in the same ear in a  
standard way.  On a spec compliant server it will just work.

thanks
david jencks

>
> -dain
>
> On Feb 22, 2007, at 3:13 PM, Ryan wrote:
>
>> You're right, I didn't quite explain things 100%.  I would like to  
>> have
>> a .ear file that contains EJBs and a Swing client.  I would like  
>> to be
>> able to deploy that .ear and have it work on Glassfish or  
>> Geronimo, but
>> don't want to change naming lookups, etc.
>>
>> I really just want to have the option of switching vendors at a later
>> date.  I will always use a matching app server and client  
>> container (ie:
>> Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).
>>
>> Ryan
>>
>>
>> Jencks wrote:
>>> I'm unclear on whether you plan to run the app client on the same
>>> vendors product as the ejb itself.
>>>
>>> If you plan to use  2 vendors you have to use corba.
>>>
>>> If you plan to use the app client container and the ejb container  
>>> from
>>> geronimo, what you are trying should work.  However for geronimo you
>>> would have to have deployed the ejb application first (assuming  
>>> it is
>>> not packaged in an ear with the app client) and the ejb app would  
>>> have
>>> to be a parent of the client app.  Under these circumstances the
>>> deployers should be able to find your ejb at deploy time and  
>>> figure out
>>> how to hook up to it when you run the app client.
>>>
>>> thanks
>>> david jencks
>>>
>>> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm working at setting up an application client and am having some
>>>> difficulty accessing EJBs on the server.  I'm running my client  
>>>> using an
>>>> application client container and am trying it out on a few  
>>>> different
>>>> application servers.
>>>>
>>>> However, I'm having difficulty finding a way to lookup EJBs in a  
>>>> vendor
>>>> independent manner.  Specifically, almost every doc I can find  
>>>> has some
>>>> variation of:
>>>>
>>>> Context initialContext = new InitialContext();
>>>> Object ref = initialContext.lookup("some vendor specific name  
>>>> here");
>>>>
>>>> If I replace "some vendor specific name here" with the proper  
>>>> vendor
>>>> specific name for each app server and re-deploy everything works.
>>>>
>>>> At first I thought I could use application-client.xml to name  
>>>> each EJB
>>>> and have the container(s) take care of the mapping, but I  
>>>> haven't had
>>>> any luck with this approach.  I tried something like this (relevant
>>>> parts only):
>>>>
>>>> <ejb-ref>
>>>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>>>     <ejb-ref-type>Session</ejb-ref-type>
>>>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>>>> </ejb-ref>
>>>>
>>>> When I deploy to Glassfish using the above I end up with a JNDI  
>>>> name of
>>>> "ejb/test1234/ConnectionTester" and can look it up using
>>>> "java:comp/env/ejb/test1234/ConnectionTester".
>>>>
>>>> However, when I try to deploy to Geronimo, I get the following  
>>>> error
>>>> (while deploying):
>>>>
>>>> org.apache.openejb.OpenEJBException: Cannot find bean
>>>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>>>
>>>> Obviously I'm missing something because Glassfish appears to use
>>>> 'ejb-ref-name' as a type of alias for the EJB name while  
>>>> Geronimo thinks
>>>> it contains the name of an existing EJB.
>>>>
>>>> Maybe I'm just not thinking clearly tonight, but isn't there  
>>>> some kind
>>>> of simple, standard way of looking up an EJB from a standalone  
>>>> client?
>>>> Is vendor independence even a realistic goal (that's what the  
>>>> spec is
>>>> for right)?
>>>>
>>>> Thanks in advance for any help,
>>>> Ryan
>>>>
>>>> P.S.  Sorry for the formatting :-(
>>>>
>>>
>>
>


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by Dain Sundstrom <da...@iq80.com>.
I suggest you put an interface in that abstracts the lookups.  This  
will let your code easily switch between vendors.

-dain

On Feb 22, 2007, at 3:13 PM, Ryan wrote:

> You're right, I didn't quite explain things 100%.  I would like to  
> have
> a .ear file that contains EJBs and a Swing client.  I would like to be
> able to deploy that .ear and have it work on Glassfish or Geronimo,  
> but
> don't want to change naming lookups, etc.
>
> I really just want to have the option of switching vendors at a later
> date.  I will always use a matching app server and client container  
> (ie:
> Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).
>
> Ryan
>
>
> Jencks wrote:
>> I'm unclear on whether you plan to run the app client on the same
>> vendors product as the ejb itself.
>>
>> If you plan to use  2 vendors you have to use corba.
>>
>> If you plan to use the app client container and the ejb container  
>> from
>> geronimo, what you are trying should work.  However for geronimo you
>> would have to have deployed the ejb application first (assuming it is
>> not packaged in an ear with the app client) and the ejb app would  
>> have
>> to be a parent of the client app.  Under these circumstances the
>> deployers should be able to find your ejb at deploy time and  
>> figure out
>> how to hook up to it when you run the app client.
>>
>> thanks
>> david jencks
>>
>> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
>>
>>> Hi,
>>>
>>> I'm working at setting up an application client and am having some
>>> difficulty accessing EJBs on the server.  I'm running my client  
>>> using an
>>> application client container and am trying it out on a few different
>>> application servers.
>>>
>>> However, I'm having difficulty finding a way to lookup EJBs in a  
>>> vendor
>>> independent manner.  Specifically, almost every doc I can find  
>>> has some
>>> variation of:
>>>
>>> Context initialContext = new InitialContext();
>>> Object ref = initialContext.lookup("some vendor specific name  
>>> here");
>>>
>>> If I replace "some vendor specific name here" with the proper vendor
>>> specific name for each app server and re-deploy everything works.
>>>
>>> At first I thought I could use application-client.xml to name  
>>> each EJB
>>> and have the container(s) take care of the mapping, but I haven't  
>>> had
>>> any luck with this approach.  I tried something like this (relevant
>>> parts only):
>>>
>>> <ejb-ref>
>>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>>     <ejb-ref-type>Session</ejb-ref-type>
>>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>>> </ejb-ref>
>>>
>>> When I deploy to Glassfish using the above I end up with a JNDI  
>>> name of
>>> "ejb/test1234/ConnectionTester" and can look it up using
>>> "java:comp/env/ejb/test1234/ConnectionTester".
>>>
>>> However, when I try to deploy to Geronimo, I get the following error
>>> (while deploying):
>>>
>>> org.apache.openejb.OpenEJBException: Cannot find bean
>>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>>
>>> Obviously I'm missing something because Glassfish appears to use
>>> 'ejb-ref-name' as a type of alias for the EJB name while Geronimo  
>>> thinks
>>> it contains the name of an existing EJB.
>>>
>>> Maybe I'm just not thinking clearly tonight, but isn't there some  
>>> kind
>>> of simple, standard way of looking up an EJB from a standalone  
>>> client?
>>> Is vendor independence even a realistic goal (that's what the  
>>> spec is
>>> for right)?
>>>
>>> Thanks in advance for any help,
>>> Ryan
>>>
>>> P.S.  Sorry for the formatting :-(
>>>
>>
>


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by Ryan <ry...@vacode.com>.
Just wanted to say thank you for the help.

Ryan

David Jencks wrote:
> 
> On Feb 22, 2007, at 3:13 PM, Ryan wrote:
> 
>> You're right, I didn't quite explain things 100%.  I would like to have
>> a .ear file that contains EJBs and a Swing client.  I would like to be
>> able to deploy that .ear and have it work on Glassfish or Geronimo, but
>> don't want to change naming lookups, etc.
>>
>> I really just want to have the option of switching vendors at a later
>> date.  I will always use a matching app server and client container (ie:
>> Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).
> 
> In that case you should be able to just use ejb-link or the equivalent
> annotation and have it just work on any compliant app server.  This
> works fine for j2ee 1.4 stuff in geronimo 1.x, I don't think its all
> working in 2.0 yet.  I'm sure it all works in glassfish as well.  If you
> are using jndi rather than injection you'll be looking up stuff in
> java:comp/env/....
> 
> 
> thanks
> david jencks
> 
>>
>> Ryan
>>
>>
>> Jencks wrote:
>>> I'm unclear on whether you plan to run the app client on the same
>>> vendors product as the ejb itself.
>>>
>>> If you plan to use  2 vendors you have to use corba.
>>>
>>> If you plan to use the app client container and the ejb container from
>>> geronimo, what you are trying should work.  However for geronimo you
>>> would have to have deployed the ejb application first (assuming it is
>>> not packaged in an ear with the app client) and the ejb app would have
>>> to be a parent of the client app.  Under these circumstances the
>>> deployers should be able to find your ejb at deploy time and figure out
>>> how to hook up to it when you run the app client.
>>>
>>> thanks
>>> david jencks
>>>
>>> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm working at setting up an application client and am having some
>>>> difficulty accessing EJBs on the server.  I'm running my client
>>>> using an
>>>> application client container and am trying it out on a few different
>>>> application servers.
>>>>
>>>> However, I'm having difficulty finding a way to lookup EJBs in a vendor
>>>> independent manner.  Specifically, almost every doc I can find has some
>>>> variation of:
>>>>
>>>> Context initialContext = new InitialContext();
>>>> Object ref = initialContext.lookup("some vendor specific name here");
>>>>
>>>> If I replace "some vendor specific name here" with the proper vendor
>>>> specific name for each app server and re-deploy everything works.
>>>>
>>>> At first I thought I could use application-client.xml to name each EJB
>>>> and have the container(s) take care of the mapping, but I haven't had
>>>> any luck with this approach.  I tried something like this (relevant
>>>> parts only):
>>>>
>>>> <ejb-ref>
>>>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>>>     <ejb-ref-type>Session</ejb-ref-type>
>>>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>>>> </ejb-ref>
>>>>
>>>> When I deploy to Glassfish using the above I end up with a JNDI name of
>>>> "ejb/test1234/ConnectionTester" and can look it up using
>>>> "java:comp/env/ejb/test1234/ConnectionTester".
>>>>
>>>> However, when I try to deploy to Geronimo, I get the following error
>>>> (while deploying):
>>>>
>>>> org.apache.openejb.OpenEJBException: Cannot find bean
>>>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>>>
>>>> Obviously I'm missing something because Glassfish appears to use
>>>> 'ejb-ref-name' as a type of alias for the EJB name while Geronimo
>>>> thinks
>>>> it contains the name of an existing EJB.
>>>>
>>>> Maybe I'm just not thinking clearly tonight, but isn't there some kind
>>>> of simple, standard way of looking up an EJB from a standalone client?
>>>> Is vendor independence even a realistic goal (that's what the spec is
>>>> for right)?
>>>>
>>>> Thanks in advance for any help,
>>>> Ryan
>>>>
>>>> P.S.  Sorry for the formatting :-(
>>>>
>>>
>>
> 


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by David Jencks <da...@yahoo.com>.
On Feb 22, 2007, at 3:13 PM, Ryan wrote:

> You're right, I didn't quite explain things 100%.  I would like to  
> have
> a .ear file that contains EJBs and a Swing client.  I would like to be
> able to deploy that .ear and have it work on Glassfish or Geronimo,  
> but
> don't want to change naming lookups, etc.
>
> I really just want to have the option of switching vendors at a later
> date.  I will always use a matching app server and client container  
> (ie:
> Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).

In that case you should be able to just use ejb-link or the  
equivalent annotation and have it just work on any compliant app  
server.  This works fine for j2ee 1.4 stuff in geronimo 1.x, I don't  
think its all working in 2.0 yet.  I'm sure it all works in glassfish  
as well.  If you are using jndi rather than injection you'll be  
looking up stuff in java:comp/env/....


thanks
david jencks

>
> Ryan
>
>
> Jencks wrote:
>> I'm unclear on whether you plan to run the app client on the same
>> vendors product as the ejb itself.
>>
>> If you plan to use  2 vendors you have to use corba.
>>
>> If you plan to use the app client container and the ejb container  
>> from
>> geronimo, what you are trying should work.  However for geronimo you
>> would have to have deployed the ejb application first (assuming it is
>> not packaged in an ear with the app client) and the ejb app would  
>> have
>> to be a parent of the client app.  Under these circumstances the
>> deployers should be able to find your ejb at deploy time and  
>> figure out
>> how to hook up to it when you run the app client.
>>
>> thanks
>> david jencks
>>
>> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
>>
>>> Hi,
>>>
>>> I'm working at setting up an application client and am having some
>>> difficulty accessing EJBs on the server.  I'm running my client  
>>> using an
>>> application client container and am trying it out on a few different
>>> application servers.
>>>
>>> However, I'm having difficulty finding a way to lookup EJBs in a  
>>> vendor
>>> independent manner.  Specifically, almost every doc I can find  
>>> has some
>>> variation of:
>>>
>>> Context initialContext = new InitialContext();
>>> Object ref = initialContext.lookup("some vendor specific name  
>>> here");
>>>
>>> If I replace "some vendor specific name here" with the proper vendor
>>> specific name for each app server and re-deploy everything works.
>>>
>>> At first I thought I could use application-client.xml to name  
>>> each EJB
>>> and have the container(s) take care of the mapping, but I haven't  
>>> had
>>> any luck with this approach.  I tried something like this (relevant
>>> parts only):
>>>
>>> <ejb-ref>
>>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>>     <ejb-ref-type>Session</ejb-ref-type>
>>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>>> </ejb-ref>
>>>
>>> When I deploy to Glassfish using the above I end up with a JNDI  
>>> name of
>>> "ejb/test1234/ConnectionTester" and can look it up using
>>> "java:comp/env/ejb/test1234/ConnectionTester".
>>>
>>> However, when I try to deploy to Geronimo, I get the following error
>>> (while deploying):
>>>
>>> org.apache.openejb.OpenEJBException: Cannot find bean
>>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>>
>>> Obviously I'm missing something because Glassfish appears to use
>>> 'ejb-ref-name' as a type of alias for the EJB name while Geronimo  
>>> thinks
>>> it contains the name of an existing EJB.
>>>
>>> Maybe I'm just not thinking clearly tonight, but isn't there some  
>>> kind
>>> of simple, standard way of looking up an EJB from a standalone  
>>> client?
>>> Is vendor independence even a realistic goal (that's what the  
>>> spec is
>>> for right)?
>>>
>>> Thanks in advance for any help,
>>> Ryan
>>>
>>> P.S.  Sorry for the formatting :-(
>>>
>>
>


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by Ryan <ry...@vacode.com>.
You're right, I didn't quite explain things 100%.  I would like to have
a .ear file that contains EJBs and a Swing client.  I would like to be
able to deploy that .ear and have it work on Glassfish or Geronimo, but
don't want to change naming lookups, etc.

I really just want to have the option of switching vendors at a later
date.  I will always use a matching app server and client container (ie:
Geronimos AS with Geronimo ACC, or Glassfish AS with Glassfish ACC).

Ryan


Jencks wrote:
> I'm unclear on whether you plan to run the app client on the same
> vendors product as the ejb itself.
> 
> If you plan to use  2 vendors you have to use corba.
> 
> If you plan to use the app client container and the ejb container from
> geronimo, what you are trying should work.  However for geronimo you
> would have to have deployed the ejb application first (assuming it is
> not packaged in an ear with the app client) and the ejb app would have
> to be a parent of the client app.  Under these circumstances the
> deployers should be able to find your ejb at deploy time and figure out
> how to hook up to it when you run the app client.
> 
> thanks
> david jencks
> 
> On Feb 22, 2007, at 1:46 AM, Ryan wrote:
> 
>> Hi,
>>
>> I'm working at setting up an application client and am having some
>> difficulty accessing EJBs on the server.  I'm running my client using an
>> application client container and am trying it out on a few different
>> application servers.
>>
>> However, I'm having difficulty finding a way to lookup EJBs in a vendor
>> independent manner.  Specifically, almost every doc I can find has some
>> variation of:
>>
>> Context initialContext = new InitialContext();
>> Object ref = initialContext.lookup("some vendor specific name here");
>>
>> If I replace "some vendor specific name here" with the proper vendor
>> specific name for each app server and re-deploy everything works.
>>
>> At first I thought I could use application-client.xml to name each EJB
>> and have the container(s) take care of the mapping, but I haven't had
>> any luck with this approach.  I tried something like this (relevant
>> parts only):
>>
>> <ejb-ref>
>>     <ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
>>     <ejb-ref-type>Session</ejb-ref-type>
>>     <remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
>> </ejb-ref>
>>
>> When I deploy to Glassfish using the above I end up with a JNDI name of
>> "ejb/test1234/ConnectionTester" and can look it up using
>> "java:comp/env/ejb/test1234/ConnectionTester".
>>
>> However, when I try to deploy to Geronimo, I get the following error
>> (while deploying):
>>
>> org.apache.openejb.OpenEJBException: Cannot find bean
>> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>>
>> Obviously I'm missing something because Glassfish appears to use
>> 'ejb-ref-name' as a type of alias for the EJB name while Geronimo thinks
>> it contains the name of an existing EJB.
>>
>> Maybe I'm just not thinking clearly tonight, but isn't there some kind
>> of simple, standard way of looking up an EJB from a standalone client?
>> Is vendor independence even a realistic goal (that's what the spec is
>> for right)?
>>
>> Thanks in advance for any help,
>> Ryan
>>
>> P.S.  Sorry for the formatting :-(
>>
> 


Re: Is there a vendor independent way of accessing EJBs from a standalone client?

Posted by David Jencks <da...@yahoo.com>.
I'm unclear on whether you plan to run the app client on the same  
vendors product as the ejb itself.

If you plan to use  2 vendors you have to use corba.

If you plan to use the app client container and the ejb container  
from geronimo, what you are trying should work.  However for geronimo  
you would have to have deployed the ejb application first (assuming  
it is not packaged in an ear with the app client) and the ejb app  
would have to be a parent of the client app.  Under these  
circumstances the deployers should be able to find your ejb at deploy  
time and figure out how to hook up to it when you run the app client.

thanks
david jencks

On Feb 22, 2007, at 1:46 AM, Ryan wrote:

> Hi,
>
> I'm working at setting up an application client and am having some
> difficulty accessing EJBs on the server.  I'm running my client  
> using an
> application client container and am trying it out on a few different
> application servers.
>
> However, I'm having difficulty finding a way to lookup EJBs in a  
> vendor
> independent manner.  Specifically, almost every doc I can find has  
> some
> variation of:
>
> Context initialContext = new InitialContext();
> Object ref = initialContext.lookup("some vendor specific name here");
>
> If I replace "some vendor specific name here" with the proper vendor
> specific name for each app server and re-deploy everything works.
>
> At first I thought I could use application-client.xml to name each EJB
> and have the container(s) take care of the mapping, but I haven't had
> any luck with this approach.  I tried something like this (relevant
> parts only):
>
> <ejb-ref>
> 	<ejb-ref-name>ejb/test1234/ConnectionTester</ejb-ref-name>
> 	<ejb-ref-type>Session</ejb-ref-type>
> 	<remote>domain.ejb.interfaces.ConnectionTesterRemote</remote>
> </ejb-ref>
>
> When I deploy to Glassfish using the above I end up with a JNDI  
> name of
> "ejb/test1234/ConnectionTester" and can look it up using
> "java:comp/env/ejb/test1234/ConnectionTester".
>
> However, when I try to deploy to Geronimo, I get the following error
> (while deploying):
>
> org.apache.openejb.OpenEJBException: Cannot find bean
> "ejb/test1234/ConnectionTester" referenced by bean "GeronimoEnc".
>
> Obviously I'm missing something because Glassfish appears to use
> 'ejb-ref-name' as a type of alias for the EJB name while Geronimo  
> thinks
> it contains the name of an existing EJB.
>
> Maybe I'm just not thinking clearly tonight, but isn't there some kind
> of simple, standard way of looking up an EJB from a standalone client?
> Is vendor independence even a realistic goal (that's what the spec is
> for right)?
>
> Thanks in advance for any help,
> Ryan
>
> P.S.  Sorry for the formatting :-(
>