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 the @annotation pointcut expression is only supported at Java 5ErrorExpressJava
- Error: Invoke-customs are only supported starting with Android O (--min-api 26)ErrorAndroidAPI
- case class inheritance
- javascript Classical InheritanceJavaScript
- [Relationships]Inheritance
- BUG記錄-Sharing is only supported for boot loader classes because bootstrap classpath has been appendebootAPP
- 解決okhttp報java.lang.IllegalStateException: closed,java.lang.IllegalStateException: closedHTTPJavaException
- 說說Prototypal Inheritance
- Important Points for Inheritance in JavaImportJava
- java.lang.IllegalStateException: closedJavaException
- java.lang.IllegalStateException: getWriteableDatabase called recursivelyJavaExceptionDatabase
- Caused by: android.os.Android
- java.lang.IllegalStateException: Service id not legal hostnameJavaException
- Dictionary inconsistency caused by CTAS in PARALLELParallel
- Entity Framework Code-First(7):Inheritance StrategyFramework
- MEMORY_TARGET not supported on this system
- GoldenGate - What is supported and what is not ....Go
- 一張圖看懂CSS cascade, specific, importance, inheritanceCSSImport
- PLC結構化文字(ST)——繼承(inheritance)繼承
- Caused by: Error: ' ' is not a valid resource name characterError
- Restricting a Method to Class-Only o Instance-OnlyREST
- let definitions are not supported by current javascript versionJavaScript
- Project facet Java version 1.8 is not supportedProjectJava
- The ENU localization is not supported by this SQL Server mediaSQLServer
- KSQLException: The authentication type 10 is not supported.SQLException
- java.lang.IllegalStateException: getOutputStream() has already been called for this responseJavaException
- java.lang.IllegalStateException:YouneedtouseaTheme.AppCompatthemeJavaExceptionAPP
- odoo 開發入門教程系列-繼承(Inheritance)Odoo繼承
- Inheritance with EF Code First: Part 1 – Table per Hierarchy (TPH)
- Inheritance with EF Code First: Part 2 – Table per Type (TPT)
- virtual inheritance 的妙用--------實現final類 (轉)
- Springboot:Caused by: java.lang.NoSuchMethodError...Spring BootJavaError
- Caused by: java.lang.NoClassDefFoundError: javax/persistence/EntityListenersJavaError
- jQuery :only-childjQuery
- jQuery :only-of-typejQuery