Web工程与RMI工程进行联调

1.首先导出RMI工程中的Service和entity类 到web工程中,以jar包的形式

 

public class ServiceManagerImpl {

private static ServiceRegist serviceRegist=null;
 
 public static ServiceRegist getServiceRegist(){
  if(null==serviceRegist){
   try {
    serviceRegist=(ServiceRegist)Naming.lookup("rmi://localhost:8888/serviceRegist");
    System.out.println("RMI Connection");
   } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   } catch (RemoteException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   } catch (NotBoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  }
  return serviceRegist;
 }
}

 

 

 

posted on 2014-06-25 21:39  rigidwang  阅读(169)  评论(0编辑  收藏  举报