Current jetty component have some trouble to setup right context path if you 
don't specify it like this
from("jetty://http://localhost:8080";)
You can change the uri like this
from("jetty://http://localhost:8080/";)

if you want to implement a proxy you need to setup the route like this
from("jetty://http://localhost:8080/?matchOnUriPrefix=true";).loadBalance().roundRobin().to("http://172.28.39.138:8080?throwExceptionOnFailure=false&bridgeEndpoint=true","http://172.168.20.118:8080?throwExceptionOnFailure=false&bridgeEndpoint=true";);


-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang



On Wednesday, August 15, 2012 at 8:10 PM, balkishore wrote:

> Dear memebers,
> This would be my first post in this forum and I am glad. I have started
> using camel a while back for a project of mine to create a load balancing
> application.
> 
> Well to start with,
> My load balncer would listen to a port, lets say 8080 and would balance all
> the incoming SOAP requests to a set of backened servers.
> These backend servers have apache tomcat installed and listen to port 8080.
> The load balancer would be recieving the request from a web browser.
> I would have configured the clients in such a way that they would send the
> request directly to load balancer. 
> 
> Now I have written a small route for initial phase, which is as follow:
> 
> 
> public class LoadBalancer {
> public static void main(String args[]) throws Exception {
> CamelContext context = new DefaultCamelContext();
> 
> context.addRoutes(new RouteBuilder() {
> 
> public void configure() {
> from("jetty://http://localhost:8080";)
> 
> .loadBalance().roundRobin().to("http://172.28.39.138:8080","http://172.168.20.118:8080";);
> }
> }); 
> 
> context.start();
> 
> Thread.sleep(100000); 
> context.stop();
> }
> }
> 
> As it can be seen, i am forwarding all the request to two ip address.
> When I run this code, I don't get any error, but my client browser shows an
> error which explicitly means that the request was not recieved by the load
> balancer server.
> And when I type localhost:8080, on the local computer where the camel is
> running, I get 
> 
> HTTP ERROR: 404
> Problem accessing /. Reason: 
> 
> Not Found
> 
> I have no idea, why the requests are not being recieved by the camel and why
> am i getting this error in the browser.
> 
> Any help would be very much appreciated. I even tried to log the incoming
> request using this piece of code
> from("jetty://http://localhost:8080";)
> .to("file:output");
> from("file://output").process(new Processor() {
> 
> private Exchange e;
> 
> public void process(Exchange exchange) throws Exception {
> System.out.println("Received exchange:" + e.getIn());
> }
> });
> 
> But it seems my camel isn't recieveing any request at all and i get nothing.
> 
> Any help would be really useful as I am struck in this phase for a long
> time.
> 
> Cheers!
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Load-balancing-camel-in-real-world-tp5717381.html
> Sent from the Camel - Users mailing list archive at Nabble.com 
> (http://Nabble.com).



Reply via email to