Artemis Entreri Creative Commons License 2011.08.10 0 0 5568

Egy példa, remote EJB hívásra:

 

Szerver oldal:

 

@Remote
public interface IRemoteBean {

  String getMessage();

}

 

@Stateless(mappendName="AkarmiBean")

public class RemoteBean implements IRemoteBean {

  public String getMessage() {
  return "Message";
  }
 
}

 

És a hívó kód:

 

public class Main {

  public static void main(String[] argsthrows Exception {

  InitialContext ctx = new InitialContext();
  IRemoteBean rb =  (IRemoteBean)ctx.lookup("AkarmiBean");
  System.out.println("=================================");
  System.out.println("EJB message :" + br.getMessage());
   System.err.println("=================================");
  }
}

 

Előzmény: bigzed (5567)