gpt4 book ai didi

java - 在 Intellij 中的 java 中使用 HtmlUnit 时出现 IncompleteClassChangeError

转载 作者:行者123 更新时间:2023-12-01 19:34:16 26 4
gpt4 key购买 nike

我尝试在 IntelliJ Ultimate 2018.3.6 中使用 HtmlUnit 和以下 Java 代码

public static void main(String[] args)
{
WebClient webClient = new WebClient();
}

这是一个 gradle 项目,所以我的 build.gradle 中有这个

compile 'net.sourceforge.htmlunit:htmlunit:2.36.0'

但是当我从 Intellij 运行上面的一行程序时,我得到了这样的错误:

Exception in thread "main" java.lang.IncompatibleClassChangeError: class org.eclipse.jetty.util.component.ContainerLifeCycle can not implement org.eclipse.jetty.util.component.Container, because it is not an interface (org.eclipse.jetty.util.component.Container is in unnamed module of loader 'app')
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3062)
at java.base/java.lang.Class.getDeclaredFields(Class.java:2249)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:298)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:204)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.buildUsageMap(AbstractJavaScriptConfiguration.java:85)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:65)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:603)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:619)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:141)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:249)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:227)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:219)
at com.tripadvisor.flights.partners.travix.TravixProcessor.main(TravixProcessor.java:10)

进程已完成,退出代码为 1

感谢任何帮助!谢谢!

最佳答案

尝试了一个全新的项目并且成功了。所以它一定是由旧项目的依赖项之一引起的,该依赖项已经包含了 htmlunit jar,该依赖项与我想在此处包含的 htmlunit jar 具有不兼容的版本

关于java - 在 Intellij 中的 java 中使用 HtmlUnit 时出现 IncompleteClassChangeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59235249/

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