• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Remote client for EJB3.0

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I developed the Stateless Bean and deployed in Glassfish and executed successfully...


But, if the bean in deployed in Remote machine, i dont know how to write client for that.

If same bean is deployed in 2 different application and in same server, how can call the specific bean.

Please help me out.(Please correct me, if i am wrong).

Thanks In Advance.
Bennet Xavier.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bennet Xavier wrote:

But, if the bean in deployed in Remote machine, i dont know how to write client for that.


The client can be the same. All you need to do is pass jndi.properties with appropriate PROVIDER_URL to point to the server.

Bennet Xavier wrote:
If same bean is deployed in 2 different application and in same server, how can call the specific bean.



Each will have a different JNDI name.
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran Pai,

thank you very much...
this will be the Provider URL..



Where i will assign the JNDI name for the Bean (how to assign JNDI name for Bean).

Thanks in advance.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are 2 parts to doing a lookup:

1) Setting up the Context properties, which including pointing to the server hosting the JNDI service. This code which you posted, is an example for this:



2) The second part (after the context has been setup) is to do a lookup using a key (also known as JNDI name) which is done as follows:



The com.bekijkhet.HelloStateless is the JNDI name. Even though it looks like a fully qualified classname of the bean interface, in reality it can be any string which represents the JNDI name of the bean. While deploying a bean on the server, each bean has a unique JNDI name on the server, so that the clients can lookup it up using that name.

 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran Pai,

Yes, i understood.

Now, the jndi name that is mentioned in the lookup operation is key, which we use for getting the bean, which has been injected already.

My question is, is there a way to assign new name for bean, while deploying in glassfish, because i didn't see any option for that.

Thanks in advance,
bennet xavier.

 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bennet Xavier wrote:
My question is, is there a way to assign new name for bean, while deploying in glassfish, because i didn't see any option for that.


Each application server provides a way to specify a JNDI name for the bean. I haven't used Glassfish, so can't say where that config goes. The Glassfish documentation on EJB3 might have the details.
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran Pai,

thank you very much.

let me search for that.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html might help
 
Bennet Xavier
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran Pai,



This is really useful : If the stand-alone java client is running on a different host than the server, set the -Dorg.omg.CORBA.ORBInitialHost property when starting the client JVM. E.g.
java -Dorg.omg.CORBA.ORBInitialHost=com.acme.Host1. This property defaults to localhost, so it is not necessary to set it if the java client is running on the same machine as the server.

thank you for your patients.

let me search for setting JNDI for bean.
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic