Closed sunxiangyang closed 4 years ago
把依赖贴出来看看
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>tu</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>tu</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.qhh6eq</groupId>
<artifactId>tushare-pro-java-sdk</artifactId>
<version>2.0.3-RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
只引入了qhh6eq这一个依赖
spring-boot-dependencies里有指定okhttp3.version为3.14.7. 会与sdk冲突. 将你的properties改为:
<properties>
<java.version>1.8</java.version>
<okhttp3.version>4.2.0</okhttp3.version>
</properties>
就可以正常运行. 后续的版本会兼容spring boot
谢谢~已经解决,感谢帮助
java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody; at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at com.github.tusharepro.core.http.Client.post(Client.java:34) at com.github.tusharepro.core.http.Client.f(Client.java:76) at com.github.tusharepro.core.http.Client.beanList(Client.java:59) at com.github.tusharepro.core.TushareProService.stockBasic(TushareProService.java:17) at com.example.tu.TuDemo.main(TuDemo.java:33) Caused by: java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody; at com.github.tusharepro.core.TusharePro$Builder.lambda$new$0(TusharePro.java:41) at com.github.tusharepro.core.http.Client.lambda$post$0(Client.java:32) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Exception in thread "main" java.io.IOException at com.github.tusharepro.core.http.Client.beanList(Client.java:72) at com.github.tusharepro.core.TushareProService.stockBasic(TushareProService.java:17) at com.example.tu.TuDemo.main(TuDemo.java:33)