gpt4 book ai didi

java.lang.IncompleteClassChangeError : the number of constructors

转载 作者:行者123 更新时间:2023-11-30 07:28:50 40 4
gpt4 key购买 nike

我对 Java 还很陌生,我正在尝试放心地绕过 API 测试。我使用以下 pom 文件尝试了我的代码:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yourcompany.restassured</groupId>
<artifactId>restassuredtest</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>0.13.1</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libfb303</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.19</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.19</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>0.13.0</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>2.4.6</version>
</dependency>

</dependencies>
</project>

最终出现此错误 - java.lang.InknownClassChangeError:运行时和编译时 com.jayway.restassured.internal.RequestSpecificationImpl$EncodingTarget 的构造函数数量不匹配。预期为 -1,但得到 2

我用谷歌搜索了很多解决方案,但没有任何效果。原因之一,据我了解是放心版本和groovy版本不匹配。但我觉得在这种情况下版本还可以。我在 IntelliJ 2016.1.1 上使用 Java 8、JDK 1.8如果您能帮助我摆脱困境,我将不胜感激。

最佳答案

Rest Assured FAQ在示例中明确指出:

Groovy 需要与 REST Assured 所依赖的版本相同

查看maven.pom文件中的REST版本保证你使用的是(2.9.0),它所依赖的Groovy版本是:Groovy 2.4.4。但你已经设置为 2.4.6。更改 pom 文件中的 Groovy 版本以消除该问题。

<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- Needs to be the same version that REST Assured depends on -->
<version>2.4.3</version>
<scope>test</scope>
</dependency>

<properties>
<scm.branch>master</scm.branch>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<groovy.version>2.4.4</groovy.version>
<gmaven.version>1.5</gmaven.version>
<hamcrest.version>1.3</hamcrest.version>
<jackson1.version>1.9.11</jackson1.version>
<jackson2.version>2.4.3</jackson2.version>
<maven-javadoc.version>2.9.1</maven-javadoc.version>
</properties>

关于java.lang.IncompleteClassChangeError : the number of constructors,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36439380/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com