PDA

View Full Version : Can I create my own RmiProxyFactoryBean client side?



timd
Feb 23rd, 2005, 04:43 PM
Because I would like my client to choose a rmi objects host/port/servicename at runtime, client side I am trying to connect to server (spring enhanced) objects like this:

---------------------------------

RmiProxyFactoryBean factory = new RmiProxyFactoryBean();
factory.setServiceInterface(IMyInterface.class);
factory.setServiceUrl("rmi://localhost:1099/MyServiceName");

IMyInterface bsi = (IMyInterface) factory.getObject();

bsi.doSomethingUsefull();

-------------------------------------

However I get back null from factory.getObject()... If I configure client side to use xml file and use FileSystemXmlApplicationContext everything works just fine.

------------------------------------

What am I doing wrong? Also, is there a better way to handle discovering client host/port/service (and connecting) at runtime (apart from generating temp xml files)?

robh
Feb 23rd, 2005, 05:43 PM
You need to call RmiProxyFactoryBean.afterPropertiesSet() before accessing the proxy.

Rob

timd
Feb 24th, 2005, 05:26 PM
that worked, cool!

lencio
Mar 20th, 2009, 04:01 PM
join it now
cmon its hard
and cool join it
cmon join it now
plz
plz
plz
plz plz
cmon join it now
plz plz plzp plz:p:D