I'm a new comer for Spring RMI and try to finish a simplest example according to Spring DOC.
The only different thing is I try to use a servlet in the client side.
The following is the fragment of client web.xml
The web.xml of server is the same.Code:<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param>
The client side applicationContext.xml:
And in the client side servlet:Code:<beans> <bean class="au.com.client.ClientObject"> <property name="accountService" ref="remoteAccountService"/> </bean> <bean id="remoteAccountService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean"> <property name="serviceUrl" value="rmi://HOST/AccountService"/> <property name="serviceInterface" value="au.com.vodafone.service.AccountService"/> </bean> </beans>
ClientObject:Code:ClientObject c = new ClientObject(); AccountService a= c.getAccountService();
The error message I got shows that "AccountService a is null". I think the problem might be the configuration in web.xml.Code:package au.com.client; import au.com.vodafone.service.AccountService; public class ClientObject { private AccountService accountService; public AccountService getAccountService() { return accountService; } public void setAccountService(AccountService accountService) { this.accountService = accountService; } }
Thanks!


Reply With Quote