| Author |
How to communicate with 2 different ejb modules residing in different appplications
|
Avneet Singh
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
Hi All I have a question on how to call amethod from a ejb class in different application to the one residing in a different application. Is it possible? What all would I need to do so. e.g. I have an ejb class in myappejb.jar which is part of my application myapp. I need to call a method in another ejb which resides in pyapp2ejb.jar part of different application called myapp2. These applications will be residing on the same application server. Need help on this
|
 |
Sunil Dixit
Ranch Hand
Joined: Sep 22, 2005
Posts: 46
|
|
Hi, You can do that,conside your ejb module in (myapp2.jar ) as client for ejb module reside in (pyapp2ejb.jar).So simply make a lookup (using Initial context and give the EJB Home JNDI name) and do your work. Your code will look in as below : InitalContext ctx = new InitialContext(); ctx.lookUp("ZZZZZ"); RemotePortableObject.narrow(...); etc.. I am not sure whether local home lookup will work or not? because its depends on which application server you�re using. But remote lookup will work for sure ! Cheers, Sunil Dixit
|
 |
Avneet Singh
Ranch Hand
Joined: Apr 25, 2006
Posts: 51
|
|
|
can i import a jar file which is in another application in the ejb that im building part of my application. The two applications are residing on the same application server
|
 |
Sunil Dixit
Ranch Hand
Joined: Sep 22, 2005
Posts: 46
|
|
Avneet, You need to pull only the interface/clasee which are reuired to complie your code. So better way is you create a common.jar file which will contains all class file that you need to complie your code. Make it sure you don't put the target jar file,if you do that then your application server wll try to deploy that. So you have two choices : 1. Create new jar that will contain only class file. 2. You delete all deployment descriptor files from target ejb module.jar Sunil
|
 |
 |
|
|
subject: How to communicate with 2 different ejb modules residing in different appplications
|
|
|