【Java开源代码栏目提醒】:网学会员鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“BookManagerClient2.java”一文,供大家参考学习
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class BookManagerClient2 {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/BookManager2");
BookManagerHome2 bmh = (BookManagerHome2)PortableRemoteObject.narrow(objref, BookManagerHome2.class);
BookManager2 bm = bmh.create();
System.out.println("Retrieving titles...");
bm.listTitles("Sams");
System.out.println("Completed Retrieval.");
}
catch (Exception e) {
System.err.println(e.getMessage());
}
}
}
上一篇:
BookManagerClient.java
下一篇:
她要是喜欢我