Closed
Description
BUG 报告
在开始报告错误之前,请确保认真查看了以下步骤:
请在提交问题之前回答这些问题,谢谢。
你使用了哪个项目?hippo4j config 还是 hippo4j server?
hippo4j config、hippo4j server
你使用了哪个版本?
最新版本
预期行为
客户端注册服务端不报错。
实际行为
org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class java.util.concurrent.ThreadFactory]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `java.util.concurrent.ThreadFactory` (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: (PushbackInputStream); line: 1, column: 295] (through reference chain: cn.hippo4j.common.model.register.DynamicThreadPoolRegisterWrapper["parameter"]->cn.hippo4j.common.model.register.DynamicThreadPoolRegisterParameter["threadFactory"])
原因分析(如果可以)
ThreadFactoryBuilder#build(cn.hippo4j.common.design.builder.ThreadFactoryBuilder) 中使用了Executors.defaultThreadFactory()
问题重现步骤
1.拉取最新版本代码,删除服务端数据库中数据,走服务器中未定义的动态线程池配置的逻辑,让客户端自己注册
2.启动服务端
3.启动hippo4j-spring-boot-starter-example
示例模块
解决方案
- 在
DynamicThreadPoolRegisterParameter#threadFactory
的属性上加上,@JsonIgnore
不进行序列化。查看服务端接口并未使用客户端上传上来的ThreadFactory
字段。