Including the java-sdk as a dependency for a Spring Boot project builds properly, but results in a "NoSuchMethodError: Companion" exception at run-time when initializing an instance of the DaprHttp.
From investigation, it appears that this has to do with the okhttp library and version mismatches:
Without Spring Boot:
[INFO] \- com.squareup.okhttp3:okhttp:jar:4.9.0:compile
[INFO] +- com.squareup.okio:okio:jar:2.8.0:compile
[INFO] | \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.0:compile
[INFO] \- org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.10:compile
[INFO] \- org.jetbrains:annotations:jar:13.0:compile
With Spring Boot:
[INFO] \- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] \- com.squareup.okio:okio:jar:1.17.2:compile
Adding this explicit dependency to the POM fixed the problem:
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
I am scratching my head why this happens since a standalone Spring Boot project does not include the okhttp library, so I am not sure why a Spring Boot + Java SDK project would downgrade this dependency, and I was unable to determine it using the Maven dependency tool.
Referencing the dependency explicitly does fix the problem. Two asks:
- Investigate if there is a better way to resolve this issue.
- Add a note to the README to help others avoid this issue.
Including the java-sdk as a dependency for a Spring Boot project builds properly, but results in a "NoSuchMethodError: Companion" exception at run-time when initializing an instance of the DaprHttp.
From investigation, it appears that this has to do with the okhttp library and version mismatches:
Without Spring Boot:
With Spring Boot:
Adding this explicit dependency to the POM fixed the problem:
I am scratching my head why this happens since a standalone Spring Boot project does not include the okhttp library, so I am not sure why a Spring Boot + Java SDK project would downgrade this dependency, and I was unable to determine it using the Maven dependency tool.
Referencing the dependency explicitly does fix the problem. Two asks: