Announcement Announcement Module
Collapse
No announcement yet.
Problem with Simple RMI Sample Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Simple RMI Sample

    Hi,

    I'm new to Spring, and tried a simple RMI example from Pro Spring. Host (server) starts, but client can't connect, per following exception. I'm sure I'm missing something simple, but I don't see what the problem is. Any help appreciated!

    Here is the rather standard looking exception.......

    INFO: Creating shared instance of singleton bean 'helloWorldRMIClient'
    org.springframework.remoting.RemoteConnectFailureE xception: Cannot connect to remote service [rmi://localhost:1099/HelloWorld]; nested exception is java.rmi.ConnectException: Connection refused to host: 184.16.4.5; nested exception is:
    java.net.ConnectException: Connection refused: connect
    java.rmi.ConnectException: Connection refused to host: 184.16.4.5; nested exception is:
    java.net.ConnectException: Connection refused: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:567)
    at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:1 01)
    at org.springframework.remoting.rmi.RmiInvocationWrap per_Stub.invoke(Unknown Source)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:347)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:294)
    at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:209)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
    at $Proxy0.getMessage(Unknown Source)
    at com.rmi.client.HelloWorldRMIClient.run(HelloWorldR MIClient.java:28)
    at com.rmi.client.HelloWorldRMIClient.main(HelloWorld RMIClient.java:23)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl .java:305)
    at java.net.PlainSocketImpl.connectToAddress(PlainSoc ketImpl.java:171)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.j ava:158)
    at java.net.Socket.connect(Socket.java:452)
    at java.net.Socket.connect(Socket.java:402)
    at java.net.Socket.<init>(Socket.java:309)
    at java.net.Socket.<init>(Socket.java:124)
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.cre ateSocket(RMIDirectSocketFactory.java:22)
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.cre ateSocket(RMIMasterSocketFactory.java:128)
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:562)
    ... 12 more
    Exception in thread "main"

  • #2
    Question?

    Did u define something like this in your server application-context.xml file ?

    <bean class="org.springframework.remoting.rmi.RmiService Exporter">
    <property name="serviceName"><value>HelloWorld</value></property>
    <property name="service"><ref bean="helloWorld"/></property>
    <property name="serviceInterface"><value>HelloWorld</value></property>
    <property name="registryPort"><value>1099</value></property>
    </bean>

    <bean id="helloWorld">
    <property name="target">
    <bean class="HelloWorld"/>
    </property>
    </bean>

    Comment


    • #3
      RMI problem

      I am creating a web application in struts with spring.In classes folder under WEB-INF i created a factory.xml file,in that file i put code like the following.i am not seperate client and server all my two interface and implemetation in same web application.Is any seprations need.please help me..i am new to sprin RMI

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

      <beans default-init-method="init">

      <bean id="dao" class="DataAccess.Impl.CustomerImpl"/>

      <bean class="org.springframework.remoting.rmi.RmiService Exporter">
      <property name="registryPort" value="1199"/>
      <property name="serviceName" value="Customerdao"/>
      <property name="service" ref="dao"/>
      <property name="serviceInterface" value="DataAccess.dao.Customerdao"/>
      </bean>

      <bean id="ProxyService1" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean" depends-on="dao">
      <property name="serviceUrl" value="rmi://192.168.168.77:1199/Customerdao"/>
      <property name="serviceInterface" value="DataAccess.dao.Customerdao"/>
      </bean>

      <bean id="EmpDAO" class="DataAccess.Impl.EmployeeDAOImpl"/>

      <!-- =============== RMI =============== -->
      <bean class="org.springframework.remoting.rmi.RmiService Exporter">
      <property name="registryPort" value="1199"/>
      <property name="serviceName" value="EmployeeDAO"/>
      <property name="service" ref="EmpDAO"/>
      <property name="serviceInterface" value="DataAccess.dao.EmployeeDAO"/>
      </bean>

      <bean class="DataAccess.valueobject.SimpleObject">
      <property name="accountService" ref="EmpDAO"/>
      </bean>

      <bean id="accountService" class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean" depends-on="EmpDAO">
      <property name="serviceUrl" value="rmi://localhost:1199/EmployeeDAO"/>
      <property name="serviceInterface" value="DataAccess.dao.EmployeeDAO"/>
      </bean>

      </beans>

      Comment

      Working...
      X