Announcement Announcement Module
Collapse
No announcement yet.
Pls Help with this err:RemoteProxyFailureException: No matching RMI stub method found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pls Help with this err:RemoteProxyFailureException: No matching RMI stub method found

    Hi,

    I am very new to Spring and am attempting to make 2 seperate applications communicate using Spring RMI. I have 2 applications running on Tomcat 5.5 (from Eclipse)and one application calls the method present in second using Spring RMI. But when i try to call the remote method, i am getting this error. Would be grateful for any help/ clues !!

    Error
    RemoteProxyFailureException: No matching RMI stub method found for: public abstract void au.com.macquarie.rmd.scorecards.service.CrwsRemote Service.saveScorecard(int); nested exception is java.lang.NoSuchMethodException: sun.rmi.registry.RegistryImpl_Stub.saveScorecard(i nt)
    at org.springframework.remoting.rmi.RmiClientIntercep torUtils.doInvoke(RmiClientInterceptorUtils.java:1 11)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:358)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:258)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)


    Remote Service

    package au.com.macquarie.rmd.scorecards.service;

    public interface CrwsRemoteService{

    public void saveScorecard(int id);
    }

    Remote Service Impl
    package au.com.macquarie.rmd.scorecards.service;

    public class CrwsRemoteServiceImpl implements CrwsRemoteService {

    public CrwsRemoteServiceImpl() {
    System.out.print("GOT CALLED");
    }
    public void saveScorecard(int id){
    System.out.println(" IT WORKS " );
    }
    }

    Remote Service Application Context

    <bean id="crwsRemoteService"
    class="au.com.macquarie.rmd.scorecards.service.Crw sRemoteServiceImpl" />

    <bean class="org.springframework.remoting.rmi.RmiService Exporter">
    <property name="serviceName" value="CrwsRemoteService"/>
    <property name="service" ref="crwsRemoteService"/>
    <property name="serviceInterface" value="au.com.macquarie.rmd.scorecards.service.Crw sRemoteService"/>
    <!-- defaults to 1099 -->
    </bean>


    Client code calling remote service

    I have a struts application from which i am trying to call the remote service

    RemoteObject remoteObject = (RemoteObject) WebApplicationContextUtils.getWebApplicationContex t(getServlet().getServletContext()).getBean("remot eObject");

    try{
    remoteObject.getRemoteService().saveScorecard(111) ;
    }catch(Exception e){
    e.printStackTrace();
    }

    Client's Application Context
    <bean id="remoteService" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
    <property name="serviceUrl" value="rmi://CrwsRemoteService"/>
    <property name="serviceInterface" value="au.com.macquarie.rmd.scorecards.service.Crw sRemoteService"/>
    </bean>

    <bean id="remoteObject" class="au.com.macquarie.rmd.workbook.struts.Remote Object">
    <property name="remoteService" ref="remoteService"/>
    </bean>


    Please let me know if i have missed providing any other useful info. And thanks a ton in advance

    Ankur

  • #2
    Have you tried something like the following for the serviceUrl property in your client-side RmiProxyFactoryBean definition?

    Code:
    <property name="serviceUrl" value="rmi://localhost:1099/CrwsRemoteService"/>

    Comment


    • #3
      Still does'nt work

      Hi Mike,

      Thanks for your reply. I tried that. but it still does'nt work and throws the same exception (Pls see below).

      1) Do i need to 'Jar' up the application in which my service is and include it in the classpath of my client ? After all known ways failed, i have currently got the service interface , ie CrwsRemoteService, in a jar and included that in the client's classpath. Is that the correct way to do things ? Or should there be 2 different CrwsRemoteService interfaces, one at the service side and one at the client side ?

      2) In my service app's applicationContext, when i add the following line, as in the Spring doc, my server does'nt even start up and the following error

      <property name="registryPort" value="1199"/>

      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'remoteService' defined in ServletContext resource [/conf/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.remoting.RemoteLookupFailureEx ception: Lookup of RMI stub failed; nested exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
      java.net.ConnectException: Connection refused: connect


      Error after Mike's suggestion -:

      [DEBUG] 01 Feb 2008 15:19:48,555 - org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:197) - Returning cached instance of singleton bean 'remoteObject'
      org.springframework.remoting.RemoteProxyFailureExc eption: No matching RMI stub method found for: public abstract void au.com.macquarie.rmd.scorecards.service.CrwsRemote Service.saveScorecard(int); nested exception is java.lang.NoSuchMethodException: sun.rmi.registry.RegistryImpl_Stub.saveScorecard(i nt)
      at org.springframework.remoting.rmi.RmiClientIntercep torUtils.doInvoke(RmiClientInterceptorUtils.java:1 11)
      at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:358)
      at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:258)
      at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
      at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy0.saveScorecard(Unknown Source)

      Comment

      Working...
      X