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;
}
}