Skip to content

[BUG]: class org.apache.tomcat.util.threads.VirtualThreadExecutor cannot be cast to class org.apache.tomcat.util.threads.ThreadPoolExecutor #586

Description

@948497465

平台

Windows

Jdk版本

jdk25

SpringBoot版本

boot3.5.3

DynamicTp版本

1.2.2-x

配置中心类型

No response

配置中心版本

No response

问题描述

当tomcat使用了VirtualThreadExecutor,启动项目的时候,报错,错误信息如下:
java.lang.ClassCastException: class org.apache.tomcat.util.threads.VirtualThreadExecutor cannot be cast to class org.apache.tomcat.util.threads.ThreadPoolExecutor (org.apache.tomcat.util.threads.VirtualThreadExecutor and org.apache.tomcat.util.threads.ThreadPoolExecutor are in unnamed module of loader 'app')
at org.dromara.dynamictp.starter.adapter.webserver.tomcat.TomcatDtpAdapter.doEnhance(TomcatDtpAdapter.java:52)
at org.dromara.dynamictp.starter.adapter.webserver.AbstractWebServerDtpAdapter.initialize(AbstractWebServerDtpAdapter.java:68)
at org.dromara.dynamictp.adapter.common.AbstractDtpAdapter.onContextRefreshedEvent(AbstractDtpAdapter.java:86)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:85)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:142)
at com.google.common.eventbus.Subscriber.lambda$dispatchEvent$0(Subscriber.java:71)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:31)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:68)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:111)
at com.google.common.eventbus.EventBus.post(EventBus.java:270)
at org.dromara.dynamictp.common.manager.EventBusManager.post(EventBusManager.java:59)
at org.dromara.dynamictp.spring.listener.DtpApplicationListener.onContextRefreshedEvent(DtpApplicationListener.java:37)
at org.dromara.dynamictp.spring.listener.OnceApplicationContextEventListener.onApplicationEvent(OnceApplicationContextEventListener.java:51)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
at org.springframework.context.event.SimpleApplicationEventMulticaster.lambda$multicastEvent$0(SimpleApplicationEventMulticaster.java:148)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.lang.Thread.run(Thread.java:1474)

复现步骤

启动项目时候报错

其他信息

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions