Caused by: java.lang.IllegalStateException: Only single-level inheritance supported: XxxxService
Spring Cloud專案啟動中,報如下異常:
Caused by: java.lang.IllegalStateException: Only single-level inheritance supported: UserClientService
at feign.Util.checkState(Util.java:129)
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:51)
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:151)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:49)
at feign.Feign$Builder.target(Feign.java:269)
at org.springframework.cloud.openfeign.HystrixTargeter.target(HystrixTargeter.java:38)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:301)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:330)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:310)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
... 63 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:57393', transport: 'socket'
Process finished with exit code 1
點選日誌Contract.java原因分析,檢視報錯程式碼:
feign\Contract.java
public List<MethodMetadata> parseAndValidateMetadata(Class<?> targetType) {
checkState(targetType.getTypeParameters().length == 0, "Parameterized types unsupported: %s",
targetType.getSimpleName());
checkState(targetType.getInterfaces().length <= 1, "Only single inheritance supported: %s",
targetType.getSimpleName());
if (targetType.getInterfaces().length == 1) {
checkState(targetType.getInterfaces()[0].getInterfaces().length == 0,
"Only single-level inheritance supported: %s",
targetType.getSimpleName());
}
final Map<String, MethodMetadata> result = new LinkedHashMap<String, MethodMetadata>();
for (final Method method : targetType.getMethods()) {
if (method.getDeclaringClass() == Object.class ||
(method.getModifiers() & Modifier.STATIC) != 0 ||
Util.isDefault(method)) {
continue;
}
final MethodMetadata metadata = parseAndValidateMetadata(targetType, method);
checkState(!result.containsKey(metadata.configKey()), "Overrides unsupported: %s",
metadata.configKey());
result.put(metadata.configKey(), metadata);
}
return new ArrayList<>(result.values());
}
分析其原因是Service介面只能繼承級別只能一級;
解決方法:
去掉Service介面父級的繼承即可。
相關文章
- Caused by: java.lang.IllegalStateException: getWriter() has already been called for this responseJavaException
- 解決The given version [xx] is not supported, only version 1 to 10 is supported in this buildUI
- Cross origin requests are only supported for protocol schemes: http, data, chromROSProtocolSchemeHTTP
- Error: Invoke-customs are only supported starting with Android O (--min-api 26)ErrorAndroidAPI
- BUG記錄-Sharing is only supported for boot loader classes because bootstrap classpath has been appendebootAPP
- java.lang.IllegalStateException: closedJavaException
- Caused by: android.os.Android
- java.lang.IllegalStateException: Service id not legal hostnameJavaException
- PLC結構化文字(ST)——繼承(inheritance)繼承
- MEMORY_TARGET not supported on this system
- Caused by:.NoSuchBeanDefinitionException: No bean named 'userInfoServiceImpl' availableBeanExceptionAI
- Springboot:Caused by: java.lang.NoSuchMethodError...Spring BootJavaError
- Caused by: Error: ' ' is not a valid resource name characterError
- PostgreSQL DBA(105) - pgAdmin(Don't do this:psql&inheritance)SQL
- odoo 開發入門教程系列-繼承(Inheritance)Odoo繼承
- Project facet Java version 1.8 is not supportedProjectJava
- cuda runtime error (801) : operation not supportedError
- KSQLException: The authentication type 10 is not supported.SQLException
- VirtualBox Host-only Adapter,Failed to create the host-only adapter 轉APTAI
- 解決 Lumen 中 client charset is not supportedclient
- System.Data.SqlClient is not supported on this platform.SQLclientPlatform
- Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615"JavaORMException
- Caused by: java.lang.NoClassDefFoundError: javax/servlet/GenericFilterJavaErrorServletFilter
- Solidity知識點集———Address, Mapping, msg.sender, require, InheritanceSolidAPPUI
- CSS E:only-of-typeCSS
- CSS E:only-childCSS
- 報錯-only final is permittedMIT
- CodeForces 1992A Only Pluses
- Only AI Flow Can Do!AI
- await is only valid in async functionAIFunction
- 問題一:Content-Type header is not supportedHeader
- Caused by: java.lang.IllegalArgumentException: port out of range:-1JavaException
- 翻譯:《實用的Python程式設計》04_02_InheritancePython程式設計
- java.lang.IllegalStateException: Cannot call sendError() after the response has been committed解讀JavaExceptionErrorMIT
- 解決Project facet Java version 1.8 is not supported.ProjectJava
- Only variable references should be returned by reference
- Http Only Cookie保護AccessTokenHTTPCookie
- MySQL 之 only_full_group_byMySql