• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic