我正在使用 Retrofit2 和 Okhttp 在我的项目中进行 HTTP 调用,该调用也使用 Selenium。一旦我添加了以下依赖项:
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我开始看到以下错误:
java.lang.NoSuchFieldError: Companion
at okhttp3.logging.HttpLoggingInterceptor$Logger$Companion$DefaultLogger.log(HttpLoggingInterceptor.kt:116)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:168)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
Run Code Online (Sandbox Code Playgroud)
我检查了一些相关问题,一切都指向依赖问题。但是,我使用的是 Okhttp 和 Retrofit2 (2.9.0) 以及 selenium-java 的最新版本:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我想要做的只是使用以下方法记录一个简单的请求:
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(logging);
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(url)
.client(httpClient.build())
.build();
Run Code Online (Sandbox Code Playgroud)
你知道可能是什么问题吗?
我在 IntelliJ 中使用最新的 Kotlin 插件
如何在 Oracle SQL 中使用一年中的一周获取日期?
我需要搜索在本周开始之后创建的条目。目前,我通过做来获得一年中的一周select to_char(sysdate,'WW') from dual;,但后来我做不到
select * from table where date > to_date(to_char(sysdate,'WW'), 'WW') 因为我得到
ORA-01820: format code cannot appear in date input format
01820. 00000 - "format code cannot appear in date input format"
*Cause:
*Action:
Run Code Online (Sandbox Code Playgroud)