I have also try what you propose but I receive this error :

java.lang.IllegalArgumentException: host parameter is null
    at
org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:206)
    at
org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:155)
    at
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionWithReference.<init>(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)
    at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
    at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at
org.apache.camel.component.http.HttpProducer.executeMethod(HttpProducer.java:164)
    at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:78)
    at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
    at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
    at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
    at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
    at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
    at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
    at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
    at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
    at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
    at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
    at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
    at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
    at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
    at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
    at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
    at
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:41)
    at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
    at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
    at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
    at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
    at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
    at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
    at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
    at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
    at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
    at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
    at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
    at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
    at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
    at
org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
    at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
    at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
    at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
    at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)


Log

15:50:52,200 | INFO  | 4454...@qtp16-0  | Tracer                           |
rg.apache.camel.processor.Logger   88 | b645e724-c4f9-4c38-afcd-c607566c9ec0
>>> (route12) from(http://localhost:8181) --> setExchangePattern: InOut <<<
Pattern:InOut,
Headers:{Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7, Keep-Alive=300,
Accept-Language=en-us,en;q=0.5, CamelHttpPath=/reportservice/incidents,
Host=localhost:8181, CamelHttpUrl=
http://localhost:8181/reportservice/incidents, Accept-Encoding=gzip,deflate,
CamelHttpUri=/reportservice/incidents, Content-Type=null,
CamelHttpQuery=null, CamelHttpMethod=GET, Connection=keep-alive,
User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5)
Gecko/20091102 Firefox/3.5.5, CamelHttpCharacterEncoding=null},
BodyType:null, Body:null
15:50:52,231 | INFO  | 4454...@qtp16-0  | Tracer                           |
rg.apache.camel.processor.Logger   88 | b645e724-c4f9-4c38-afcd-c607566c9ec0
>>> (route12) setExchangePattern: InOut --> http://localhost:8282/ <<<
Pattern:InOut, Headers:{Keep-Alive=300,
CamelHttpPath=/reportservice/incidents, Accept-Language=en-us,en;q=0.5,
Connection=keep-alive, CamelHttpQuery=null,
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7, Content-Type=null,
CamelHttpCharacterEncoding=null, CamelHttpUrl=
http://localhost:8181/reportservice/incidents, User-Agent=Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102
Firefox/3.5.5, CamelHttpMethod=GET, CamelHttpUri=/reportservice/incidents,
Accept-Encoding=gzip,deflate,
Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
Host=localhost:8181}, BodyType:null, Body:null
15:50:52,262 | INFO  | 4454...@qtp16-0  | Tracer                           |
rg.apache.camel.processor.Logger   88 | b645e724-c4f9-4c38-afcd-c607566c9ec0
>>> (route12) http://localhost:8282/ --> http://localhost:8282/ <<<
Pattern:InOut, Headers:{Keep-Alive=300,
CamelHttpPath=/reportservice/incidents, Accept-Language=en-us,en;q=0.5,
Connection=keep-alive, CamelHttpQuery=null,
Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7, Content-Type=null,
CamelHttpCharacterEncoding=null, CamelHttpUrl=
http://localhost:8181/reportservice/incidents, User-Agent=Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102
Firefox/3.5.5, CamelHttpMethod=GET, CamelHttpUri=/reportservice/incidents,
Accept-Encoding=gzip,deflate,
Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
Host=localhost:8181}, BodyType:null, Body:null

Config


        <camel:route>
            <camel:from uri="jetty:
http://localhost:8181?matchOnUriPrefix=true"/>
            <camel:setExchangePattern pattern="InOut"/>
            <camel:loadBalance>
                <camel:roundRobin/>
                <camel:to uri="http://localhost:8282/"/>
            </camel:loadBalance>
        </camel:route>

        <camel:route>
            <camel:from uri="jetty:
http://localhost:8282?matchOnUriPrefix=true"/>
            <camel:to uri="cxfbean:reportIncidentServiceBean"/>
        </camel:route>

        <camel:route>
            <camel:from uri="jms:queue:inout"/>
            <camel:bean ref="reportIncidentDAOService" method="getReports"/>
        </camel:route>

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Fri, Dec 11, 2009 at 3:47 PM, Adrian Trenaman <trena...@progress.com>wrote:

> In the second route, you should use jetty: in the uri! When you want to
> listen for http traffic you should always use jetty:.
>
> Cheers,
> Ade
>
> ----- Original Message -----
> From: Charles Moulliard <cmoulli...@gmail.com>
> To: users@camel.apache.org <users@camel.apache.org>
> Sent: Fri Dec 11 09:43:32 2009
> Subject: Re: camel-jetty and loadbalancing
>
> We progress.
>
> With the following config, the HTTP request (
> http://localhost:8181/reportservice/incidents/) is able to reach the
> server
> 8282 but it fails to answer and generate error
>
> java.lang.IllegalArgumentException: host parameter is null
>    at
>
> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:206)
>    at
>
> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:155)
>
>        <camel:route>
>            <camel:from uri="jetty:
> http://localhost:8181?matchOnUriPrefix=true"/>
>            <camel:setExchangePattern pattern="InOut"/>
>            <camel:loadBalance>
>                <camel:roundRobin/>
>                <camel:to uri="http://localhost:8282/"/>
>            </camel:loadBalance>
>        </camel:route>
>
>        <camel:route>
>            <camel:from uri="http://localhost:8282"/>
>            <camel:to uri="cxfbean:reportIncidentServiceBean"/>
>        </camel:route>
>
> The doc mentions that a http endpoint cannot used as a consumer (= from)
> but
> as a producer (=to)
>
> Regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>
> On Fri, Dec 11, 2009 at 3:25 PM, Adrian Trenaman <trena...@progress.com
> >wrote:
>
> > You should use camel-http instead of -jetty  for your http producer
> > endpoints! I.e. Start your uri for the producers with http:// rather
> than
> > jetty:http://
> >
> > HTH,
> > Ade
> >
> > ----- Original Message -----
> > From: Charles Moulliard <cmoulli...@gmail.com>
> > To: users@camel.apache.org <users@camel.apache.org>
> > Sent: Fri Dec 11 09:13:35 2009
> > Subject: camel-jetty and loadbalancing
> >
> > I try to use loadbalancing with camel-jetty but I'm not quite sure that
> > what
> > I do is correct.
> >
> > Is this configuration correct ?
> >
> >        <camel:route>
> >            <camel:from
> > uri="jetty:http://localhost:8080<
> > http://localhost:8080?matchOnUriPrefix=true>
> > "/>
> >            <camel:loadBalance>
> >                <camel:roundRobin/>
> >                <camel:to
> > uri="jetty:http://localhost:8282<
> > http://localhost:8282?matchOnUriPrefix=true>
> > "/>
> >                <camel:to
> > uri="jetty:http://localhost:8383<
> > http://localhost:8383?matchOnUriPrefix=true>
> > "/>
> >                <camel:to
> > uri="jetty:http://localhost:8484<
> > http://localhost:8484?matchOnUriPrefix=true>
> > "/>
> >            </camel:loadBalance>
> >        </camel:route>
> >
> >        <camel:route>
> >            <camel:from uri="jetty:
> > http://localhost:8282?matchOnUriPrefix=true"/>
> >            <camel:to uri="cxfbean:reportIncidentServiceBean"/>
> >        </camel:route>
> >
> > Regards,
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> > twitter : http://twitter.com/cmoulliard
> > Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >
> > Apache Camel Group :
> > http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >
>

Reply via email to