-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentinel 和 Feign 集成时,方法名称写错 #1345
Comments
Could you please provide the detailed error message? |
当我在集成 Sentinel 和 Feign 时,运行github上的示例代码,代码地址如下: 遇到了类似于上述的问题,具体问题日志如下: 所用版本:Spring Cloud Version:Hoxton.SR3 |
@fangjian0423 Could you please take a look? |
Hoxton.SR1 中,fegin.context接口的定义为parseAndValidatateMetadata 我目前的解决办法是:在工程合适的地方,新建包com.alibaba.cloud.sentinel.feign。重新修改一下SentinelContractHolder即可 `
} |
By reproducing it, I found two ways to solve this:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
<version>2.2.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.SR3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.2.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> Note that the The reason is as @pointerv described. |
对,我目前也是这样解决的。thanks.
半缘 忘忧
[email protected]
exgwbvdtcfqpbgce
…------------------ 原始邮件 ------------------
发件人: "Felix"<[email protected]>;
发送时间: 2020年3月20日(星期五) 下午2:26
收件人: "alibaba/Sentinel"<[email protected]>;
抄送: "半缘 忘忧"<[email protected]>; "Author"<[email protected]>;
主题: Re: [alibaba/Sentinel] Sentinel 和 Feign 集成时,方法名称写错 (#1345)
Hoxton.SR1 中,fegin.context接口的定义为parseAndValidatateMetadata
Hoxton.SR3 中,fegin.context接口的定义为parseAndValidateMetadata。就是之前版本中定义的方法名拼写错误,所以在Hoxton.SR1后面的版本更正过来,所以出现Caused by: java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List;错误。
我目前的解决办法是:在工程合适的地方,新建包com.alibaba.cloud.sentinel.feign。重新修改一下SentinelContractHolder即可
`public class SentinelContractHolder implements Contract {
private final Contract delegate; /** * map key is constructed by ClassFullName + configKey. configKey is constructed by * {@link feign.Feign#configKey} */ public final static Map<String, MethodMetadata> METADATA_MAP = new HashMap<>(); public SentinelContractHolder(Contract delegate) { this.delegate = delegate; } @OverRide public List<MethodMetadata> parseAndValidateMetadata(Class<?> targetType) { List<MethodMetadata> metadatas = delegate.parseAndValidateMetadata(targetType); metadatas.forEach(metadata -> METADATA_MAP .put(targetType.getName() + metadata.configKey(), metadata)); return metadatas; }
}`
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
good idea, thank u
半缘 忘忧
[email protected]
exgwbvdtcfqpbgce
…------------------ 原始邮件 ------------------
发件人: "cdfive"<[email protected]>;
发送时间: 2020年3月21日(星期六) 凌晨0:15
收件人: "alibaba/Sentinel"<[email protected]>;
抄送: "半缘 忘忧"<[email protected]>; "Author"<[email protected]>;
主题: Re: [alibaba/Sentinel] Sentinel 和 Feign 集成时,方法名称写错 (#1345)
By reproducing it, I found two ways to solve this:
Change Spring Cloud Version from Hoxton.SR3 to Hoxton.RELEASE
Remain using Hoxton.SR3, and specified the version of spring-cloud-openfeign-dependencies
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-openfeign-dependencies</artifactId> <version>${spring-cloud-openfeign.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Hoxton.SR3</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>2.2.0.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
Note that the spring-cloud-openfeign-dependencies should be in front of spring-cloud-dependencies.
The reason is as @pointerv described.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
碰到了相同的问题,谢谢 |
碰到了同样的问题,多谢 |
Spring Cloud Alibaba 2.2.0.RELEASE based on Hoxton.RELEASE. Spring Cloud Alibaba 2.2.1.RELEASE based on Hoxton.SR3 and it's going to release soon. |
Closing this issue as SCA 2.2.1.RELEASE has been released. Thanks all :) |
Caused by: java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidatateMetadata(Ljava/lang/Class;)Ljava/util/List; Caused by: java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidatateMetadata(Ljava/lang/Class;)Ljava/util/List; |
2.2.1.RELEASE Hoxton.SR3 可以适配了。但是要去中央仓库下载Hoxton.SR3 阿里云仓库还没有 |
* Remove the useless files * Replace PermSize with MetaspaceSize, details see http://openjdk.java.net/jeps/122 * Update DLedgerCommitLog.java (alibaba#1145) Delete useless code * Remove the duplicate content * Polish the comment (alibaba#1107) * Minor Typo fix (alibaba#860) * [ISSUE alibaba#1082] Fix disconnection of HA (alibaba#1083) * fixed the text description in chinese doc (alibaba#1339) * fix /dev/shm not found on some OSs (alibaba#1345) * Refactor the protection logic when pulling * change the MQVersion variable to rocketmq 4.5.2 version; * Minor polish * Fix the wrong package name * [maven-release-plugin] prepare release rocketmq-all-4.5.2 * [maven-release-plugin] prepare for next development iteration * [RIP-15]Add Ipv6 support for RocketMQ
版本:spring-cloud-alibaba-2.1.0.RELEASE
Sentinel 和 Feign 集成时,方法名称写错,有如下接口:
List<MethodMetadata> feign.Contract.parseAndValidateMetadata(Class<?> targetType);
在 spring-cloud-alibaba-sentinel-2.1.0.RELEASE.jar 中,实现了上述方法,不过方法名却写错了,导致目前无法使用,实现方法如下:
List<MethodMetadata> com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidatateMetadata(Class<?> targetType);
The text was updated successfully, but these errors were encountered: