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; } }
Web工程与RMI工程进行联调,布布扣,bubuko.com
时间: 2024-12-19 19:36:54