aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to  connect  between EJB  and anothe EJB in another JVM  ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to  connect  between EJB  and anothe EJB in another JVM  ???" Watch "How to  connect  between EJB  and anothe EJB in another JVM  ???" New topic
Author

How to connect between EJB and anothe EJB in another JVM ???

somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Now, I don't know , how to connect/lookup between EJB in one JVM and EJB in another JVM ...


help me please ...


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
EJB in machine A can use JNDI to lookup the remote component or home interface for the EJB in machine B, creating it (if necessary), and then use the EJBObject to get the services from EJB in machine B.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919




Value for Context.INITIAL_CONTEXT_FACTORY depends on the app server. Context.PROVIDER_URL is the server URL.


Groovy
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Of course, EJB in machine B must register its services and JNDI name to the JNDI registry. Or, there maybe a Service Locator that knows which locations that the EJB located.

Nick
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
What do you mean connect between EJB in one machine and EJB in other machine?
Is it about a cluster? Or is it only 2 applications communication?
If the 1st is true: you declare ejb-ref and than you perform the normal lookup (and is not important where exactly the container is running)
If 2nd is true: your EJB wanting connection will need to do the same steps as a regular client.


blog - InfoQ.com
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

If 2nd is true: your EJB wanting connection will need to do the same steps as a regular client


yes, but dont forget to pass the URL of the 2nd machice to the InitialContext.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Thank you very much for all answer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to connect between EJB and anothe EJB in another JVM ???