开发者

Call to EJB method from a remote jboss server(servlet)

开发者 https://www.devze.com 2023-03-25 20:02 出处:网络
case 1: I\'m having war in one jboss server and ejb jar开发者_如何转开发 in another jboss server.

case 1: I'm having war in one jboss server and ejb jar开发者_如何转开发 in another jboss server. I want to call my ejb from my servlet which is present in another server. How to call it. can any one help me with a working sample and required configurations.

case 2: Message Driven Bean(MDB) in my transaction jboss server and business method in another jboss server. How to call my business method from my transaction server.

kindly help me to solve this case

Thanks in advance


I can't (won't) help with a working example, but this is what you have to do:

  1. Your EJBs (session beans) must be configured in a way to support remote access, RMI.
  2. You have to export your EJB client classes into a separate JAR file; those are the interfaces and base classes required to perform an RMI call (stubs). This is required as clients (your WAR) must understand how to deserialize/serialize the RMI communication between your servlets and the remote EJBs.
  3. Make the exported EJB client JAR available to your WAR file
  4. Define an initial context pointing to your remote EJB server as described here.
  5. Deploy and run it...

BTW: A personal opinion, RMI communication is painful and you should try to avoid it as it tightly couples the client (your WAR) to the remote EJBs.

EDIT: Which EJB version and which IDE do you use?

0

精彩评论

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

关注公众号