Hi,
i have deployed two EARs on one server. i want to access one method in one java class in EAR to another java class in second EAR.
what are different ways to achieve this. which one is best way to do.
Thanks
Hi,
i have deployed two EARs on one server. i want to access one method in one java class in EAR to another java class in second EAR.
what are different ways to achieve this. which one is best way to do.
Thanks
Expose it as a web service and consume it in the other app.
Your application server may allow sharing the JNDI context, and thus you can obtain the required class by JNDI lookup, but I wouldn't recommend. This would mean your two ears will have to always live within the same app server (or cluster).
I would simply use a Stateless Session Bean to expose this method to another (remote) Java application.
Exposing your method as a web serices would also work... but I don't really see the point of using web services between two Java applications. The marshalling of objects to XML and of XML to objects would consume CPU cycles for nothing if there is no need for a language agnostic protocol (which is the case between two Java applications).