0% found this document useful (0 votes)
21 views2 pages

Compan I A Remote

The document contains code for a remote interface, session bean, and main class that access the session bean. The remote interface defines get methods to return a message, address, and company name. The session bean implements these methods to return hardcoded strings. The main class looks up the session bean and calls its get methods to retrieve and display the message, company name, and address.

Uploaded by

Sebas Jimenez M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Compan I A Remote

The document contains code for a remote interface, session bean, and main class that access the session bean. The remote interface defines get methods to return a message, address, and company name. The session bean implements these methods to return hardcoded strings. The main class looks up the session bean and calls its get methods to retrieve and display the message, company name, and address.

Uploaded by

Sebas Jimenez M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CompaniaRemote.

java

package ejb;

import javax.ejb.Remote;

@Remote
public interface CompaniaRe
mote {

String getMensaje();

String getDireccion();

String getNcompania();
}

SessionBean.java

package ejb;

import javax.ejb.Stateless;

@Stateless(mappedName="SessionBea
n")
public class SessionBean implements
CompaniaRemote {

public String getMensaje() {


return "Se necesita Servicio en X
departamento";
}
public String getDireccion(){
return "Av. SiempreViva y calle falsa
123";
}
public String getNcompania(){
return "ESPE;
}
}

Main.java
package CompaniaRemote;

import ejb.CompaniaRemote;
import javax.naming.InitialContext;

public class Main


{

public static void main(String[] args) throws Ex


ception {

InitialContext cmp = new InitialContext();


CompaniaRemote sb = (CompaniaRemote) cmp.lo
okup("Bean30");
System.err.println("El
mensaje es:" + sb.getMessage());
System.err.println("Nombre
compania:" + sb.getCompanyname());
System.err.println("La direccin
es:" + sb.getAddress());
}
}

You might also like