[ https://issues.apache.org/jira/browse/CAMEL-21536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17905039#comment-17905039 ]
Bjorn Beskow edited comment on CAMEL-21536 at 12/12/24 7:12 AM: ---------------------------------------------------------------- {color:#000000}The problem seems to be caused by {color}[https://github.com/apache/camel-spring-boot/pull/1278/commits/cd4deb0eda78054641056eb948a797b0a5a04560]{color:#000000} which now requires a ThreadPoolTaskExecutor to be configured:{color} {color:#000000} @Bean(name = "platform-http-engine"){color} {color:#000000} @ConditionalOnMissingBean(PlatformHttpEngine.class){color} {color:#000000} public PlatformHttpEngine springBootPlatformHttpEngine(Environment env) {{color} {color:#000000} Executor executor;{color} {color:#000000} if (executors != null && !executors.isEmpty()) {{color} {color:#000000} executor = executors.stream(){color} {color:#000000} .filter(e -> {*}e instanceof ThreadPoolTaskExecutor{*}){color} {color:#000000} .findFirst(){color} {color:#000000} .orElseThrow(() -> new RuntimeException("No ThreadPoolTaskExecutor configured"));{color} {color:#000000} } else {{color} {color:#000000} throw new RuntimeException("No Executor configured");{color} {color:#000000} }{color} {color:#000000} int port = Integer.parseInt(env.getProperty("server.port", "8080"));{color} {color:#000000} return new SpringBootPlatformHttpEngine(port, executor);{color} {color:#000000} }{color} {color:#000000}If using virtual threads, the default auto-configuration of an executor (defined in TaskExecutorConfiguration) instead uses a SimpleAsyncTaskExecutor:{color} {color:#000000}class TaskExecutorConfigurations {{color} {color:#000000} TaskExecutorConfigurations() {{color} {color:#000000} }{color} {color:#000000} @Configuration({color} {color:#000000} proxyBeanMethods = false{color} {color:#000000} ){color} {color:#000000} @ConditionalOnMissingBean(\{Executor.class}){color} {color:#000000} static class TaskExecutorConfiguration {{color} {color:#000000} TaskExecutorConfiguration() {{color} {color:#000000} }{color} {color:#000000} @Bean({color} {color:#000000} name = \{"applicationTaskExecutor", "taskExecutor"}{color} {color:#000000} ){color} {color:#000000} *@ConditionalOnThreading(Threading.VIRTUAL)*{color} {color:#000000} *SimpleAsyncTaskExecutor* applicationTaskExecutorVirtualThreads(SimpleAsyncTaskExecutorBuilder builder) {{color} {color:#000000} return builder.build();{color} {color:#000000} }{color} {color:#000000} @Lazy{color} {color:#000000} @Bean({color} {color:#000000} name = \{"applicationTaskExecutor", "taskExecutor"}{color} {color:#000000} ){color} {color:#000000} @ConditionalOnThreading(Threading.PLATFORM){color} {color:#000000} ThreadPoolTaskExecutor applicationTaskExecutor(ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder) {{color} {color:#000000} return threadPoolTaskExecutorBuilder.build();{color} {color:#000000} }{color} {color:#000000} }{color} {color:#000000}Hence no ThreadPoolTaskExecutor instance is auto-configured by default, and therefore the exception is thrown.{color} {color:#000000}This problem didn't exist in 4.8.1, it is a regression problem introduced in 4.8.2/4.9.0.{color} was (Author: beskow): {color:#000000}The problem seems to be caused by {color}[https://github.com/apache/camel-spring-boot/pull/1278/commits/cd4deb0eda78054641056eb948a797b0a5a04560]{color:#000000} which now requires a ThreadPoolTaskExecutor to be configured:{color} {color:#000000} @Bean(name = "platform-http-engine"){color} {color:#000000} @ConditionalOnMissingBean(PlatformHttpEngine.class){color} {color:#000000} public PlatformHttpEngine springBootPlatformHttpEngine(Environment env) {{color} {color:#000000} Executor executor;{color} {color:#000000} if (executors != null && !executors.isEmpty()) {{color} {color:#000000} executor = executors.stream(){color} {color:#000000} .filter(e -> {*}e instanceof ThreadPoolTaskExecutor{*}){color} {color:#000000} .findFirst(){color} {color:#000000} .orElseThrow(() -> new RuntimeException("No ThreadPoolTaskExecutor configured"));{color} {color:#000000} } else {{color} {color:#000000} throw new RuntimeException("No Executor configured");{color} {color:#000000} }{color} {color:#000000} int port = Integer.parseInt(env.getProperty("server.port", "8080"));{color} {color:#000000} return new SpringBootPlatformHttpEngine(port, executor);{color} {color:#000000} }{color} {color:#000000}If using virtual threads, the default auto-configuration of an executor (defined in TaskExecutorConfiguration) instead uses a SimpleAsyncTaskExecutor:{color} {color:#000000}class TaskExecutorConfigurations {{color} {color:#000000} TaskExecutorConfigurations() {{color} {color:#000000} }{color} {color:#000000} @Configuration({color} {color:#000000} proxyBeanMethods = false{color} {color:#000000} ){color} {color:#000000} @ConditionalOnMissingBean(\{Executor.class}){color} {color:#000000} static class TaskExecutorConfiguration {{color} {color:#000000} TaskExecutorConfiguration() {{color} {color:#000000} }{color} {color:#000000} @Bean({color} {color:#000000} name = \{"applicationTaskExecutor", "taskExecutor"}{color} {color:#000000} ){color} {color:#000000} *@ConditionalOnThreading(Threading.VIRTUAL)*{color} {color:#000000} *SimpleAsyncTaskExecutor* applicationTaskExecutorVirtualThreads(SimpleAsyncTaskExecutorBuilder builder) {{color} {color:#000000} return builder.build();{color} {color:#000000} }{color} {color:#000000} @Lazy{color} {color:#000000} @Bean({color} {color:#000000} name = \{"applicationTaskExecutor", "taskExecutor"}{color} {color:#000000} ){color} {color:#000000} @ConditionalOnThreading(Threading.PLATFORM){color} {color:#000000} ThreadPoolTaskExecutor applicationTaskExecutor(ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder) {{color} {color:#000000} return threadPoolTaskExecutorBuilder.build();{color} {color:#000000} }{color} {color:#000000} }{color} {color:#000000}Hence no ThreadPoolTaskExecutor instance exists by default, and therefore the exception is thrown.{color} {color:#000000}This problem didn't exist in 4.8.1, it is a regression problem introduced in 4.8.2/4.9.0.{color} > camel-platform-http-starter throws "No ThreadPoolTaskExecutor configured" if > virtual threads are enabled > -------------------------------------------------------------------------------------------------------- > > Key: CAMEL-21536 > URL: https://issues.apache.org/jira/browse/CAMEL-21536 > Project: Camel > Issue Type: Bug > Components: camel-spring-boot-starters > Affects Versions: 4.8.2, 4.9.0 > Environment: SpringBoot 3.4.0, Java 21. > Reporter: Bjorn Beskow > Priority: Major > > {color:#000000}If spring.threads.virtual.enabled = true, a Camel application > that uses camel-platform-http-starter fails at startup with{color} > {color:#000000}Caused by: java.lang.RuntimeException: No > ThreadPoolTaskExecutor configured{color} > {color:#000000} {color}{color:#000000}at > org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpAutoConfiguration.lambda$springBootPlatformHttpEngine$1(SpringBootPlatformHttpAutoConfiguration.java:54) > ~[camel-platform-http-starter-4.9.0.jar:4.9.0]{color} > {color:#000000} {color}{color:#000000}at > java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]{color} > {color:#000000} {color}{color:#000000}at > org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpAutoConfiguration.springBootPlatformHttpEngine(SpringBootPlatformHttpAutoConfiguration.java:54) > ~[camel-platform-http-starter-4.9.0.jar:4.9.0]{color} > {color:#000000} {color}{color:#000000}at > java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) > ~[na:na]{color} > {color:#000000} {color}{color:#000000}at > java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]{color} > {color:#000000} {color}{color:#000000}at > org.springframework.beans.factory.support.SimpleInstantiationStrategy.lambda$instantiate$0(SimpleInstantiationStrategy.java:171) > ~[spring-beans-6.2.0.jar:6.2.0]{color} > {color:#000000} {color}{color:#000000}... 24 common frames omitted{color} > {color:#000000}unless a ThreadPoolTaskExecutor is explicitly > configured.{color} -- This message was sent by Atlassian Jira (v8.20.10#820010)