[jira] [Commented] (CAMEL-8853) CXF endpoint with a relative address cannot be invoked by a producer template
[ https://issues.apache.org/jira/browse/CAMEL-8853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16939399#comment-16939399 ] Alexandru commented on CAMEL-8853: -- [~nimnio] For my case I wrote this code (just after the camel context is started - i start it myself by using @UseWithAdvice ) : {code:java} // code placeholder {code} protected void rewriteUrlWithServerPort() \{ final String START_URL = "http://localhost:"; + randomPort + "/parc/ws"; Map wsCxfCamelEndpoints = applicationContext.getBeansOfType(CxfSpringEndpoint.class); wsCxfCamelEndpoints.values() .stream() .filter(cxfSpringEndpoint -> cxfSpringEndpoint.getAddress().startsWith("/")) .forEach(cxfSpringEndpoint -> cxfSpringEndpoint.setAddress(START_URL + cxfSpringEndpoint.getAddress())); } {code:java} // code placeholder {code} > CXF endpoint with a relative address cannot be invoked by a producer template > - > > Key: CAMEL-8853 > URL: https://issues.apache.org/jira/browse/CAMEL-8853 > Project: Camel > Issue Type: Bug > Components: camel-cxf >Affects Versions: 2.15.2 >Reporter: Tomas Rohovsky >Priority: Minor > Attachments: cxf-producer-template.zip > > > If you invoke this Camel CXF endpoint by a producer template: > {code} > serviceClass="org.example.cxf_producer_template.GreetingService"/> > {code} > you will get: > {code} > org.apache.camel.CamelExecutionException: Exception occurred during execution > on the exchange: Exchange[Message: Tom] > at > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:645)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.example.cxf_producer_template.ProducerProcessor.process(ProducerProcessor.java:12)[265:cxf-producer-template:0.0.1.SNAPSHOT] > at > org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_71] > at java.util.TimerThread.run(Timer.java:505)[:1.7.0_71] > Caused by: java.lang.IllegalArgumentException: URI is not absolute > at java.net.
[jira] [Commented] (CAMEL-8853) CXF endpoint with a relative address cannot be invoked by a producer template
[ https://issues.apache.org/jira/browse/CAMEL-8853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16855759#comment-16855759 ] Freeman Fang commented on CAMEL-8853: - The relative address of cxf endpoint means using serlvet transport, it assume the endpoint is deployed into servlet container. In the test code, which suppose to use the plain http transport, should use absolute url instead. > CXF endpoint with a relative address cannot be invoked by a producer template > - > > Key: CAMEL-8853 > URL: https://issues.apache.org/jira/browse/CAMEL-8853 > Project: Camel > Issue Type: Bug > Components: camel-cxf >Affects Versions: 2.15.2 >Reporter: Tomas Rohovsky >Priority: Minor > Fix For: Future > > Attachments: cxf-producer-template.zip > > > If you invoke this Camel CXF endpoint by a producer template: > {code} > serviceClass="org.example.cxf_producer_template.GreetingService"/> > {code} > you will get: > {code} > org.apache.camel.CamelExecutionException: Exception occurred during execution > on the exchange: Exchange[Message: Tom] > at > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:645)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.example.cxf_producer_template.ProducerProcessor.process(ProducerProcessor.java:12)[265:cxf-producer-template:0.0.1.SNAPSHOT] > at > org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_71] > at java.util.TimerThread.run(Timer.java:505)[:1.7.0_71] > Caused by: java.lang.IllegalArgumentException: URI is not absolute > at java.net.URI.toURL(URI.java:1095)[:1.7.0_71] > at > org.apache.cxf.transport.http.Address.getURL(Address.java:45)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620123] > at > org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:93)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620123] > at > or
[jira] [Commented] (CAMEL-8853) CXF endpoint with a relative address cannot be invoked by a producer template
[ https://issues.apache.org/jira/browse/CAMEL-8853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16687050#comment-16687050 ] David Sharpe commented on CAMEL-8853: - Just FYI, I encountered this using Camel 2.22.1. I work around it by making the URI a package-private field of my RouteBuilder class, and then overriding it with an absolute URI in a @BeforeClass method in the unit test. {code:java} @BeforeClass static public void replaceRelativeUriWithAbsoluteUri() { port = AvailablePortFinder.getNextAvailable(24000); BestRoute.CXF_URI_BEST = "cxf://http://localhost:"; + port + "/BestAdapter/webservices/best?wsdlURL=BestFamilyHealth.wsdl&serviceClass=" + BestFamilyHealth.class.getName() + "&loggingFeatureEnabled={{cxfLoggingFeatureEnabled}}"; } {code} > CXF endpoint with a relative address cannot be invoked by a producer template > - > > Key: CAMEL-8853 > URL: https://issues.apache.org/jira/browse/CAMEL-8853 > Project: Camel > Issue Type: Bug > Components: camel-cxf >Affects Versions: 2.15.2 >Reporter: Tomas Rohovsky >Priority: Minor > Fix For: Future > > Attachments: cxf-producer-template.zip > > > If you invoke this Camel CXF endpoint by a producer template: > {code} > serviceClass="org.example.cxf_producer_template.GreetingService"/> > {code} > you will get: > {code} > org.apache.camel.CamelExecutionException: Exception occurred during execution > on the exchange: Exchange[Message: Tom] > at > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:645)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.example.cxf_producer_template.ProducerProcessor.process(ProducerProcessor.java:12)[265:cxf-producer-template:0.0.1.SNAPSHOT] > at > org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_71] > at java.util.TimerThread.run(Timer.java:505)[:1.7.0_71] > Caused by: java.lang.IllegalArgumentException: URI is not absolute >
[jira] [Commented] (CAMEL-8853) CXF endpoint with a relative address cannot be invoked by a producer template
[ https://issues.apache.org/jira/browse/CAMEL-8853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14934762#comment-14934762 ] Claus Ibsen commented on CAMEL-8853: Yeah if you use cxf:bean then I think we should lookup the endpoint and grab an absolute url for the http to use. > CXF endpoint with a relative address cannot be invoked by a producer template > - > > Key: CAMEL-8853 > URL: https://issues.apache.org/jira/browse/CAMEL-8853 > Project: Camel > Issue Type: Bug > Components: camel-cxf >Affects Versions: 2.15.2 >Reporter: Tomas Rohovsky > Fix For: Future > > Attachments: cxf-producer-template.zip > > > If you invoke this Camel CXF endpoint by a producer template: > {code} > serviceClass="org.example.cxf_producer_template.GreetingService"/> > {code} > you will get: > {code} > org.apache.camel.CamelExecutionException: Exception occurred during execution > on the exchange: Exchange[Message: Tom] > at > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:645)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.example.cxf_producer_template.ProducerProcessor.process(ProducerProcessor.java:12)[265:cxf-producer-template:0.0.1.SNAPSHOT] > at > org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:165)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:73)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at java.util.TimerThread.mainLoop(Timer.java:555)[:1.7.0_71] > at java.util.TimerThread.run(Timer.java:505)[:1.7.0_71] > Caused by: java.lang.IllegalArgumentException: URI is not absolute > at java.net.URI.toURL(URI.java:1095)[:1.7.0_71] > at > org.apache.cxf.transport.http.Address.getURL(Address.java:45)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620123] > at > org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:93)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620123] > at > org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:105)[123:org.apache.cxf.cxf-rt-transports-http:3