开发者

how to access method from one ear to another ear on same app server

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 on开发者_JAVA百科e is best way to do.

Thanks


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).


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜