Hi,

I have been trying to use /*recipientList*/ to resolve dynamic target
endpoints while using Camel as an HTTP proxy between a client and a server.
Everything works fine without /recipientList/ - if I do something like this:

@Override
    public void configure() throws Exception {
       
from("servlet://mytest/?matchOnUriPrefix=true&servletName=camelHttpTransportServlet").
       
to("http://www.google.com?bridgeEndpoint=true&throwExceptionOnFailure=false";);
}


However, I want to be able to use recipientList to to get the target
end[point at runtime, like this:

    @Override
    public void configure() throws Exception {
       
from("servlet://route/?matchOnUriPrefix=true&servletName=camelHttpTransportServlet")
                .recipientList(method("myTestRouterClass",
"doStuffAndRouteTo"));
}


Where the bean that implements the recipients list resolving looks like
this:


public class MyTestRouterClass {

    @RecipientList
    public String doStuffAndRouteTo() {
        // do stuff, e.g. resolve actual destination endpoint based on
exchange headers, etc.
        // using www.google.com for the example 
        return
"http://www.google.com/?bridgeEndpoint=true&throwExceptionOnFailure=false";;
    }
}

The above method gets called, but I get the following exception:

org.apache.camel.NoSuchEndpointException: No endpoint could be found for:
org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream@1ac2e78c,
please check your classpath contains the needed Camel component jar.
        at
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:65)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:88)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.RecipientListProcessor.resolveEndpoint(RecipientListProcessor.java:223)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.RecipientListProcessor.createProcessorExchangePairs(RecipientListProcessor.java:163)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:208)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.RecipientList.sendToRecipientList(RecipientList.java:153)
~[camel-core-2.12.1.jar:2.12.1]
        at 
org.apache.camel.processor.RecipientList.process(RecipientList.java:112)
~[camel-core-2.12.1.jar:2.12.1]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
~[camel-core-2.12.1.jar:2.12.1]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
~[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)
[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)
[camel-core-2.12.1.jar:2.12.1]
        at
org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:127)
[camel-http-2.12.1.jar:2.12.1]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
[javax.servlet-3.0.0.v201112011016.jar:na]
        at 
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1448)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilter(WebRequestTraceFilter.java:111)
[spring-boot-actuator-0.5.0.M2.jar:0.5.0.M2]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
[spring-web-4.0.0.M3.jar:4.0.0.M3]
        at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
[spring-web-4.0.0.M3.jar:4.0.0.M3]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:150)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter.doFilter(AbstractPreAuthenticatedProcessingFilter.java:94)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
[spring-web-4.0.0.M3.jar:4.0.0.M3]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
[spring-security-web-3.2.0.RC1.jar:3.2.0.RC1]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilter(MetricFilterAutoConfiguration.java:97)
[spring-boot-actuator-0.5.0.M2.jar:0.5.0.M2]
        at
org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilter(MetricFilterAutoConfiguration.java:82)
[spring-boot-actuator-0.5.0.M2.jar:0.5.0.M2]
        at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
[jetty-security-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
[jetty-servlet-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at org.eclipse.jetty.server.Server.handle(Server.java:368)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:488)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:932)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:994)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
[jetty-http-8.1.9.v20130131.jar:8.1.9.v20130131]
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
[jetty-http-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
[jetty-server-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
[jetty-io-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
[jetty-io-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
[jetty-util-8.1.9.v20130131.jar:8.1.9.v20130131]
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
[jetty-util-8.1.9.v20130131.jar:8.1.9.v20130131]
        at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]


What is missing? 
(Nott sure if it is related at all… Note that I am using Jetty 8 in my web
application, which is a later version than the one that is bundled by
default with Camel (v.7). Could that be a problem?  I kind of doubt that it
causes this issue. Ideally I'd want to use the latest Jetty, but the
application fails to start because the packaging has been changed in v9, and
Camel is looking for some classes in a package that no longer exists. Are
there any plans to update Camel to use the latest Jetty?)

Thanks for your help!



--
View this message in context: 
http://camel.465427.n5.nabble.com/problem-using-recipientList-NoSuchEndpointException-CachedOutputStream-WrappedInputStream-tp5744249.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to