最好给个调用的代码,多谢!

解决方案 »

  1.   

    1.jb自带客户端测试ejb test client
    2.
    try {
          //get naming context
          Context context = getInitialContext();      //look up jndi name
          Object ref = context.lookup("ParticipantRemote");
          //look up jndi name and cast to Home interface
          participantRemoteHome = (ParticipantRemoteHome) PortableRemoteObject.narrow(ref, ParticipantRemoteHome.class);
          if (logging) {
            long endTime = System.currentTimeMillis();
            log("Succeeded initializing bean access through Home interface.");
            log("Execution time: " + (endTime - startTime) + " ms.");
          }
        } private Context getInitialContext() throws Exception {
        String url = "t3://kkk:7001";
        String user = null;
        String password = null;
        Properties properties = null;
        try {
          properties = new Properties();
          properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
          properties.put(Context.PROVIDER_URL, url);
          if (user != null) {
            properties.put(Context.SECURITY_PRINCIPAL, user);
            properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
          }      return new InitialContext(properties);
        }
        catch(Exception e) {
          log("Unable to connect to WebLogic server at " + url);
          log("Please make sure that the server is running.");
          throw e;
        }
      }
    一些set get方法之类 public static void main(String[] args) {
        ParticipantTestClient1 client = new ParticipantTestClient1();
     }3.在其它文件中这么调用
    ParticipantTestClient1 client = new ParticipantTestClient1();client.xx();