This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to communicate with 2 different ejb modules residing in different appplications

 
Avneet Singh
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic