建议更新版本
HantaoCai opened this issue · 3 comments
spring boot 2.7.0 + 不支持
HttpResult.Body res = OkHttps.sync(BaseConstant.AUTH_BASE_URL + BaseConstant.CHECK_TOKEN)
.addBodyPara(BaseConstant.JWT_TOKEN, jwt)
.post()
.getBody().cache();
return dealWithResponse(res);
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
另外
FastjsonMsgConvertor 想换用fastjson2
应该是 okhttp 或 okio 的版本问题,参考:https://ok.zhxu.cn/v3/questions.html#java-lang-nosuchfielderror-companion
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
</dependency>
<dependency>
<groupId>com.ejlchina</groupId>
<artifactId>okhttps</artifactId>
<exclusions>
<exclusion>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</exclusion>
</exclusions>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>com.ejlchina</groupId>
<artifactId>okhttps-fastjson</artifactId>
<exclusions>
<exclusion>
<groupId>com.ejlchina</groupId>
<artifactId>okhttps</artifactId>
</exclusion>
</exclusions>
<version>3.5.2</version>
</dependency>
有点丑陋了 可以用了
这样即可,不用写那么多:
<dependency>
<groupId>com.ejlchina</groupId>
<artifactId>okhttps-fastjson</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
</dependency>