ejb@glassfish.java.net

Re: EJB3.0 - session bean to session bean cross app server remote ref

From: Ming Chan <Ming.Chan_at_Sun.COM>
Date: Fri, 26 Mar 2010 11:42:08 -0400

Fixed typo, GF is for glassfish (changed from GL) sorry.



Thank you for your reply Kenneth.

What you suggested worked great in my test project in which one ejb
makes remote call to another ejb in a different GF instance.

Now I have another follow up question, hope you don't mind.

Is there another way to achieve the same cross ejb and cross GF instance
remote call so that the remote ejb's host name and port are specified
programmatically rather than statically in sun-ejb-jar.xml ?

The reason I asked is, we can configure sun-ejb-jar.xml for it to point
to a target EJB in a development environment during coding. But then
after development the same project will be deployed to different
environments such as UAT, Production and a few other environments in
between. This would mean every time we deploy the same project to a
different environment the deployer would need to rememeber to change the
host name/port in the sun-ejb-jar.xml file so that they can point to the
target environment that the project is being deployed into.

Would it be possible to specify the host_name and port programmatically
? So that these information can be looked up as system properties from
the GF instance in the environment that the project is being deployed into ?

Hope my question makes sense and thanks again for your help.

Regards,
Ming



Kenneth Saks wrote:
> On Mar 26, 2010, at 9:50 AM, Ming Chan wrote:
>
>
>> Hello,
>>
>> Thanks for publishing the very detailed information here:
>>
>> https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#cross-appserverremoteref
>>
>> I have a follow up question.
>>
>> I would like to access from one stateless session bean (SLSB) to another
>> stateless session bean (SLSB) using remote EJB interface. Both are
>> EJB3.0 session beans running on difference instances of glassfish 2.1.
>> Each of these session beans is running on its own glassfish instance and
>> these two glassfish instances do not belong to a same cluster.
>>
>> The mentioned reference suggests we do the following:
>>
>> Within the servlet :
>>
>> @EJB(name="fooejbref")
>> private FooRemote fooRemote;
>>
>> Within sun-web.xml :
>>
>> <ejb-ref>
>> <ejb-ref-name>fooejbref</ejb-ref-name>
>> <jndi-name>corbaname:iiop:host2:3700#Foo</jndi-name>
>> </ejb-ref>
>>
>> How to access a remote SLSB from another SLSB (rather than from a servlet) ?
>>
>
> Hi Ming,
>
> In that case, the @EJB would be placed within the SLSB bean class and the
> ejb-ref elements would be put in a sun-ejb-jar.xml file.
>
> --ken
>
>
>> Thanks in advance.
>>
>> Ming
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>