geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: Is there a vendor independent way of accessing EJBs from a standalone client?
Date Fri, 23 Feb 2007 15:26:39 GMT
I suggest you put an interface in that abstracts the lookups.  This  
will let your code easily switch between vendors.


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 :-(

View raw message