Announcement Announcement Module
Collapse
No announcement yet.
Can I create my own RmiProxyFactoryBean client side? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I create my own RmiProxyFactoryBean client side?

    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)?

  • #2
    You need to call RmiProxyFactoryBean.afterPropertiesSet() before accessing the proxy.

    Rob

    Comment


    • #3
      that worked, cool!

      Comment


      • #4
        yoyoyoyoyoyo yo yo join it

        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

        Comment

        Working...
        X