报错解决:java.lang.AbstractMethodError: io.restassured.internal.RequestSpecificationImpl.invokeMethod

本文档描述了在使用rest-assured框架时遇到的`java.lang.AbstractMethodError`问题。错误源于不兼容的Groovy版本,因为rest-assured 4.3版本需要Groovy 3以上,但项目中使用的是JDK 1.8。解决方案包括将rest-assured版本降级到4.2,或者删除引起冲突的`spring-boot-starter-parent`依赖。
摘要由CSDN通过智能技术生成
  • 问题描述:使用rest-assured框架时,运行报错java.lang.AbstractMethodError:
    io.restassured.internal.RequestSpecificationImpl.invokeMethod

  • 环境:maven项目,testng-restassured,jdk1.8

  • 解决思路
    首先查看jdk1.8文档找到了AbstractMethodError的原因

public class AbstractMethodError
extends IncompatibleClassChangeError
Thrown when an application tries to call an abstract method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of some class has incompatibly changed since the currently executing method was last compiled

继续查看了rest-assured的官方文档以及相应报错,以及相关的帖子,帖子链接为:

https://ask.csdn.net/questions/7339023?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522161977387516780262542447%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=161977387516780262542447&biz_id=4&utm_medium=distribute.pc_search_result.none-task-ask_topic-2~all~first_rank_v2~rank_v29-2-7339023.pc_search_result_hbase_insert&utm_term=rest_assured++java.lang.AbstractMethodError%3A+io.restassured.internal.RequestSpecificationImpl.invokeMethod

其中提到了groovy版本的问题,rest-assured4.3的版本匹配的groovy3以上的版本,而我的jdk为1.8。所以降低了rest-assured的版本为4.2,从而解决问题
另外也发现本地工程jar有冲突,删除

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
    </parent>

同样能解决问题

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值