I have 2 .ear file under a single domain (eg : abc.ear, def.ear). How to communicate between them?

1 Answers

0
cmoetzing On

You can use Remote Method Invocation. Usually the beans of your application will be registered in the application server upon deployment. With the correct name you can then use a lookup to get that remote bean (remote meaning a bean from the other .ear). From there on you an use that bean as if it was a local one.

I am sure you can find a good tutorial on RMI for your specific application server.

EDIT: I just noticed that communicate is a rather broad term and my interpretation might not fit what you want. RMI is used to call methods and objects. If communicate means to transfer data only you could also use a middleware like Java Message Service to send messages to the other .ear.