简体   繁体   中英

How to access EJB3 remotely?

I am using JBOSS AS-7 as SERVER-A and tomcat as SERVER-B.

I have developed an EJB and deployed it on SERVER-A in a JAR, and I want to call this EJB from Server-B. The problem is how, can I access the EJB from SERVER-B?

The EJB code is given below :

package demo.ejb;

import javax.ejb.Remote;

@Remote
public interface RemoteBeanInterface {

   public void say(String saying);
}


package demo.ejb.session.stateless;

import javax.ejb.Remote;
import javax.ejb.Stateless;

import demo.ejb.RemoteBeanInterface;

@Stateless(name = "StatelessBeanDemo")
public class StatelessBeanDemo implements RemoteBeanInterface {

   @Override
   public void say(String saying) {
      System.out.println("[Say] : " + saying + "");
   }
}

Can, anyone help me how can I access/call EJB from SERVER-B?

In this example you can find all you need to lookup a remote EJB in JBoss. It includes also the maven dependencies you will need, take a look in the client project.

https://github.com/jbossas/quickstart/tree/master/ejb-remote/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM