是的,可以用ant或者一些IDE环境,比如JB

解决方案 »

  1.   

    谢谢,还请问在JBuilder下如何测试??
      

  2.   

    工程属性的server设置成支持EJB的,然后new一个EJB MODULE
    在JB环境下开发,发布,调试
      

  3.   

    在JB里面有EJBClient,新建一个客户测试后输入下面即可
    package com.ziyang.ejb;
    import javax.ejb.*;
    import javax.naming.*;
    import java.rmi.*;
    import java.util.*;
    public class ProductClient {
    public static void main(String[] args) throws Exception {
     ProductHome home = null;
    try {
    Context ctx = new InitialContext(System.getProperties());
           home = (ProductHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("RemoteProductHome"), ProductHome.class);
    home.create("123-456-7890", "P5-350", "350 Mhz Pentium", 200);
    home.create("123-456-7891", "P5-400", "400 Mhz Pentium", 300);
    home.create("123-456-7892", "P5-450", "450 Mhz Pentium", 400);
    home.create("123-456-7893", "SD-64", "64 MB SDRAM", 50);
    home.create("123-456-7894", "SD-128", "128 MB SDRAM", 100);
    home.create("123-456-7895", "SD-256", "256 MB SDRAM", 200);
    Iterator i = home.findByName("SD-64").iterator();
    System.out.println("The following product descriptions match the product name SD-64:");
    while (i.hasNext()) {
    Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
    System.out.println(prod.getDescription());
    } System.out.println("Calling finder to find all products that cost $200");
    i = home.findByBasePrice(200).iterator();
    while (i.hasNext()) {
    Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
    System.out.println(prod.getDescription());
    }
    }
    catch (Exception e) {
    e.printStackTrace();
    }
    finally {
    if (home != null) {
    System.out.println("Destroying products..");
    /*  * 查找所有products
     */
    Iterator i = home.findAllProducts().iterator();
    while (i.hasNext()) {
    try {
    Product prod = (Product) javax.rmi.PortableRemoteObject.narrow(i.next(), Product.class);
    if (prod.getProductID().startsWith("123")) {
    prod.remove();
    }
    }
    catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    }
    }
    }