Announcement Announcement Module
Collapse
No announcement yet.
RMI connection refused after server restart Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RMI connection refused after server restart

    Greetings,

    I have a problem and I really don't know what is going on. I have a very basic service exported via RMI. The client is a webapp deployed on Tomcat. Everything works fine until I decide to shut down the service layer. At this point, as expected, I get connection errors in the client. After I restart the service though, I keep getting
    org.springframework.remoting.RemoteConnectFailureE xception: Could not connect to remote service [...] nested exception is java.rmi.ConnectException: Connection refused

    If I reload the webapp in Tomcat's manager app, it works again, so it would appear to be a caching issue of some sort.

    Here are the relevant XML deffinitions:
    -client part:
    <bean id="someBean" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
    <property name="serviceUrl" value="rmi://127.0.0.1:6666/someApp"/>
    <property name="serviceInterface" value="test.HelloInterface"/>
    </bean>
    -server part
    <bean class="org.springframework.remoting.rmi.RmiService Exporter">
    <property name="serviceName" value="someApp"/>
    <property name="service" ref="helloBean"/>
    <property name="serviceInterface" value="test.HelloInterface"/>
    <property name="registryPort" value="6666"/>
    </bean>

    Am I missing something? Or is it expected behavior that if the server is restarted the client must also be restarted? It seems to me that when the bean is instantiated it acquires a connection and keeps trying to reuse the exact same connection through its entire lifetime.

    Any hints would be much appreciated. Thanks.

    Note: I use Spring Framework version 2.5.5 on both client and server (probably irrelevant)

  • #2

    ....never mind..... found the problem...

    If anybody else gets into such problems...

    <bean id="beanId" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
    <property name="serviceUrl" value="rmi://127.0.0.1:6666/appName"/>
    <property name="serviceInterface" value="test.HelloI"/>
    <!--property name="cacheStub" value="false"/-->
    <property name="lookupStubOnStartup" value="false"/>
    <property name="refreshStubOnConnectFailure" value="true"/>
    </bean>

    It appears that the defaults for the properties cacheStub, lookupStubOnStartup and refreshStubOnConnectFailure are true, true and false (the cache stub I understand, the lookupOnStartup I don't agree with but I see why some might consider it a reasonable default, but why refreshOnError is set thus baffles me)... Why would anybody use such defaults is beyond my understanding (but I have been told that my ideas of common sense are not that common so...)

    Comment

    Working...
    X