Enterprise1Home home = (Enterprise1Home) PortableRemoteObject.narrow(obj,Enterprise1Home.class);
  Enterprise1 acct = home.create();这个是类型转化错误。

解决方案 »

  1.   

    我的一个例子,改成这样格式看看public class UmInfo {
     private Organization org;
     
     private ContactHome contactHome;
     
     private CardIDEjbServiceHome cardHome ;
     private CardIDEjbService card ;
     
     private Contact contact;
     
     private InitialContext ctx;
     
     public OrgVO orgVO;
     
     public UmInfo() throws Exception {
     
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY,
      "weblogic.jndi.WLInitialContextFactory");
            
      properties.put(Context.PROVIDER_URL,"t3://10.13.72.159:7001");
     
        ctx = new InitialContext(properties);
      String jndi = "com/paic/epass/epasscms/biz/service/ejb/CardIDEjbService";
      jndi ="ejb/epasscms/CardIDService";
      Object jndiobj = ctx.lookup(jndi);
      this.cardHome = (CardIDEjbServiceHome)PortableRemoteObject.narrow(jndiobj,
      CardIDEjbServiceHome.class);
      card = cardHome.create();
      
     }
      

  2.   

    你的思路有点问题,首先servlet和Ejb不要放在同一个包中。应该把servlet放在另外一个包里面,而且只要import home和主接口就好了,不要import bean。
    否则你的程序加载的时候会加载一个bean从而有了主接口,然后你通过home又create一个主接口,这两个主接口会有冲突。