hassin: package com.easou.metasearch.service; import java.util.List; import java.util.Map; import com.caucho.hessian.client.HessianProxyFactory; public class ServiceTest { public static void main(String []args) throws Exception { String url = "http://192.168.1.12/module"; HessianProxyFactory factory = new HessianProxyFactory(); ModuleService search = (SearchService) factory.create(ModuleService.class, url); Map map = search.dosomething(param); System.out.println("aaaa"); } } rmi: // 不需要通过BeanFactory直接动态调用远程对象 DistributeCenterBO distributeCenterBO = null; RmiProxyFactoryBean rmiProxyFactoryBean = new RmiProxyFactoryBean(); rmiProxyFactoryBean.setServiceInterface(DistributeCenterBO.class); rmiProxyFactoryBean.setServiceUrl( "rmi://localhost:1199/DistributeCenterBO"); try { rmiProxyFactoryBean.afterPropertiesSet(); //更改ServiceInterface或ServiceUrl之后必须调用该方法,来获取远程调用桩 } catch (Exception ex) { } if (rmiProxyFactoryBean.getObject() instanceof DistributeCenterBO) { distributeCenterBO = (DistributeCenterBO) rmiProxyFactoryBean.getObject(); distributeCenterBO.register(SubscriberImpl.subscriberId); }