[ 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} > <cxf-camel:cxfEndpoint id="greetingService" address="/greeting-service" > 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.0.4.redhat-620123] > at > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:496)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620123] > at > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620123] > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620123] > at > org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:516)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620123] > at > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:418)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620123] > at > org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:116)[207:org.apache.camel.camel-cxf: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.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:375)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:343)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:343)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.ProducerCache.send(ProducerCache.java:201)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:128)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:132)[198:org.apache.camel.camel-core:2.15.1.redhat-620123] > ... 18 more > {code} > It works as expected if you specify an absolute path instead: > {code} > <cxf-camel:cxfEndpoint id="greetingService" > address="http://localhost:8182/cxf/greeting-service" > serviceClass="org.example.cxf_producer_template.GreetingService"/> > {code} > I think that if a relative path is specified, it should be internally > translated to the absolute path, in this case > {{http://localhost:8181/cxf/greeting-service}}. A reproducer is attached. -- This message was sent by Atlassian JIRA (v7.6.3#76005)