Announcement Announcement Module
No announcement yet.
HttpInvokerServiceExporter + RemoteConnectFailureException Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HttpInvokerServiceExporter + RemoteConnectFailureException

    I am having problem using HttpInvokerServiceExporter. Please take a look at the code and suggest what do I do.
    I have used RmiServiceExporter and RmiProxyFactoryBean which worked fine. But, when I switched the code to HttpInvokerServiceExporter, it started giving errors. Please suggest any code changes.

    <?xml version="1.0"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "">
    <bean id="helloWorldService" class="com.HelloWorldImpl">

    <bean id="helloWorldServiceExporter"
    class="org.springframework.remoting.rmi.RmiService Exporter"> <property
    name="serviceName" value="HelloWorldN" /> <property name="service"
    ref="helloWorldService" /> <property name="serviceInterface"
    value="com.HelloWorld" /> <property name="registryPort" value="9000"
    /> <property name="servicePort" value="9001" /> </bean> <bean
    class="org.springframework.remoting.rmi.RmiProxyFa ctoryBean">
    <property name="serviceUrl" value="rmi://localhost:9000/HelloWorldN"
    /> <property name="serviceInterface" value="com.HelloWorld" /> </bean>

    <bean name="HelloWorldN"
    class="org.springframework.remoting.httpinvoker.Ht tpInvokerServiceExporter">
    <property name="service" ref="helloWorldService" />
    <property name="serviceInterface" value="com.HelloWorld" />

    <bean id="helloWorldproxyService"
    class="org.springframework.remoting.httpinvoker.Ht tpInvokerProxyFactoryBean">
    <property name="serviceUrl" value="http://localhost:8080/HelloWorldN" />
    <property name="serviceInterface" value="com.HelloWorld" />

    <bean id="helloWorldHandler" class="com.RMIClient">
    <property name="helloWorld" ref="helloWorldproxyService" />



    Java Code:


    ClassPathXmlApplicationContext factory = new ClassPathXmlApplicationContext("applicationContext .xml");

    System.out.println("factory created");

    RMIClient bean1 = (RMIClient) factory.getBean("helloWorldHandler");

    HelloWorld s = bean1.getHelloWorld();



    org.springframework.remoting.RemoteConnectFailureE xception: Could not connect to HTTP invoker remote service at [http://localhost:8080/HelloWorldN]; nested exception is Connection refused: connect

  • #2
    Use [ code][/code ] tags whne posting code !!!!

    You will need an app server to deploy your app, the HttpInvoker stuff needs a webserver it doesn't work from the command line.


    • #3
      A quick and lightweight way to do this is to use an embedded Jetty server. It only requires that you drop in a few small JAR files into your classpath, and add a few lines of code.

      I wrote about it here.