Access Application Server from EJB Client

S

sss

Finally I get it run the sample ejb client using EJB3.0.
However, now i want to know how to connect the application server
from a different computer.( i need to specify the ip and port right? )



package converter.client;

import converter.ejb.ConverterTestRemote;
import java.math.BigDecimal;
import javax.ejb.EJB;

/**
*
* @author ian
*/
public class ConverterClient {

@EJB
private static ConverterTestRemote converterBean;


/** Creates a new instance of Client */
public ConverterClient(String[] args) {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
ConverterClient client = new ConverterClient(args);
client.doConversion();
}

public void doConversion() {
try {
BigDecimal param = new BigDecimal("100.00");
BigDecimal yenAmount = converterBean.dollarToYen(param);

System.out.println("$" + param + " is " + yenAmount + " Yen.");

BigDecimal euroAmount = converterBean.yenToEuro(yenAmount);
System.out.println(yenAmount + " Yen is " + euroAmount + "
Euro.");

System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
 
J

Jim Cheng

Are u using Sun's Java Enterprise Application Server?
You may want to take a look at the attributes of javax.ejb.EJB and try
to set attribute values of the @EJB annotation.

Regards,
Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top