Pascal Schumacher created CAMEL-14236:
-----------------------------------------

             Summary: camel-platform-http-starter: not useable
                 Key: CAMEL-14236
                 URL: https://issues.apache.org/jira/browse/CAMEL-14236
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.0.0
            Reporter: Pascal Schumacher


https://camel.apache.org/components/latest/platform-http-component.html says:
{quote}The Platform HTTP is used to allow Camel to use the existing HTTP server 
from the rumtime. For example when running Camel on Spring Boot...{quote}

But when I try to use the component e.g. with this simple route:

{code:java}
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class HelloRoute extends RouteBuilder {

    @Override
    public void configure() throws Exception {
        from("platform-http:/hello")
            .setBody(constant("hello"));
    }
}
{code}
start-up of the application fails with :
{code}
2019-11-30 13:17:02.953 ERROR 9648 --- [  restartedMain] 
o.s.boot.SpringApplication               : Application run failed
org.apache.camel.FailedToStartRouteException: Failed to start route route1 
because of Route(route1)[From[platform-http:/hello] -> [SetBody[hello]]...
       at 
org.apache.camel.impl.engine.BaseRouteService.warmUp(BaseRouteService.java:131) 
~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.doWarmUpRoutes(AbstractCamelContext.java:3152)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.safelyStartRouteServices(AbstractCamelContext.java:3047)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.doStartOrResumeRoutes(AbstractCamelContext.java:2836)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2640)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.lambda$doStart$2(AbstractCamelContext.java:2445)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext$$Lambda$1253.0000000000000000.run(Unknown
 Source) ~[na:na]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2462)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2443)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.spring.boot.SpringBootCamelContext.doStart(SpringBootCamelContext.java:39)
 ~[camel-spring-boot-3.0.0.jar:3.0.0]
       at 
org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:117) 
~[camel-api-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2352)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:121) 
~[camel-spring-3.0.0.jar:3.0.0]
       at 
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:157)
 ~[camel-spring-3.0.0.jar:3.0.0]
       at 
org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
 ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
 ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE]
       at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
 ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) 
~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
 ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:315) 
~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) 
~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) 
~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
       at test.Application.main(Application.java:10) ~[classes/:na]
       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
~[na:na]
       at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 ~[na:na]
       at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[na:na]
       at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
       at 
org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
 ~[spring-boot-devtools-2.2.1.RELEASE.jar:2.2.1.RELEASE]
Caused by: java.lang.IllegalStateException: PlatformHttpEngine neither set on 
this PlatformHttpEndpoint neither found in Camel Registry.
       at 
org.apache.camel.component.platform.http.PlatformHttpEndpoint.doStart(PlatformHttpEndpoint.java:148)
 ~[camel-platform-http-3.0.0.jar:3.0.0]
       at 
org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:117) 
~[camel-api-3.0.0.jar:3.0.0]
       at 
org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:70)
 ~[camel-api-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.BaseRouteService.doWarmUp(BaseRouteService.java:144)
 ~[camel-base-3.0.0.jar:3.0.0]
       at 
org.apache.camel.impl.engine.BaseRouteService.warmUp(BaseRouteService.java:129) 
~[camel-base-3.0.0.jar:3.0.0]
       ... 33 common frames omitted
{code}

Complete example can be found here: 
https://github.com/PascalSchumacher/CamelSpringBootPlatformHttpTest

I do not see any way to fix this other than creating a custom 
{{PlatformHttpEngine}} implementation. Am I missing something?





--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to