0 Replies Latest reply on Apr 27, 2010 8:19 AM by jcs_jean-claude.souvignet

    LoadBalance http service - host parameter is null Exception

    jcs_jean-claude.souvignet

      Hello,

       

      I use Fuse ESB 4.2.0

       

      I would like to test LoadBalancing by Bus on http services.

       

      First of all I test the service without load balancing :

      My camel route is :

      -


      from("jetty:http://localhost:998/hello")

        .setExchangePattern(ExchangePattern.InOut)

        .setHeader(Exchange.HTTP_URI , constant("http://localhost:9198"))

        .to("http://localhost:9198/hello");

      -


       

      As Camel specified in documentation, I used setHeader(Exchange.HTTP_URI ,...) to set up the HTTP_URI in header of exchange. (Without I have exception host parameter is null).

      This route work perfectly.

       

      I would like to load balance on two services :

      The camel route I defined is :

      -


      from("jetty:http://localhost:998/hello")

           .setExchangePattern(ExchangePattern.InOut)

           .loadBalance()

           .roundRobin()

           .to(new String[]{"http://localhost:9198/hello","http://localhost:9298/hello"});

      -


       

      But I can't define HTTP_URI to one or the other URI because it should be loadbalanced.

       

      In this case I have the exception :

      -


      java.lang.IllegalArgumentException: host parameter is null

           at org.apache.commons.httpclient.HttpConnection.(MultiThreadedHttpConnectionManager.java:1145)

           at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$ConnectionPool.createConnection(MultiThreadedHttpConnectionManager.java:762)

           at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:476)

           at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)

      -


       

       

      How can I load balance on two http service outside of the bus ?

       

      Thanks In advance.

       

      Edited by: jcs on Apr 27, 2010 12:18 PM