Hi there,
so while I was developing a new binding I updated my main dependency (microsoft-graph from version 2.7.1 to 3.2.0) that uses okhttp3 in the background. Since microsoft-graph:3.0.0 they are using okhttp3:4.9.1 and okhttp3 requires kotlin-stdlib:1.4.10 since it hit version 4.
First I tried to just use the okhttp + okio part in my dependencies:
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>3.2.0</version>
</dependency>
<!-- rest of microsoft-graph -->
</dependencies>
This compiled but the OH logs didn’t seem very happy with this:
16:28:25.730 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.microsofttodo.internal.handler.MicrosoftToDoBridgeHandler@6144cb9f': kotlin/jvm/internal/Intrinsics
java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt) ~[?:?]
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47) ~[?:?]
at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:471) ~[?:?]
at com.microsoft.graph.httpcore.HttpClients.custom(HttpClients.java:32) ~[?:?]
at com.microsoft.graph.httpcore.HttpClients.createDefault(HttpClients.java:49) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.getHttpClient(BaseClient.java:178) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.getHttpProvider(BaseClient.java:186) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.buildClient(BaseClient.java:273) ~[?:?]
at com.microsoft.graph.requests.GraphServiceClient$Builder.buildClient(GraphServiceClient.java:250) ~[?:?]
at org.openhab.binding.microsofttodo.internal.api.MicrosoftToDoApi.<init>(MicrosoftToDoApi.java:56) ~[?:?]
at org.openhab.binding.microsofttodo.internal.handler.MicrosoftToDoBridgeHandler.initialize(MicrosoftToDoBridgeHandler.java:103) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics cannot be found by org.openhab.binding.microsofttodo_3.1.0.202104161347
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:519) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171) ~[org.eclipse.osgi-3.16.200.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
... 21 more
16:28:25.759 [ERROR] [.core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'microsofttodo:account:b1425db912': kotlin/jvm/internal/Intrinsics
java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt) ~[?:?]
at okhttp3.ConnectionPool.<init>(ConnectionPool.kt:47) ~[?:?]
at okhttp3.OkHttpClient$Builder.<init>(OkHttpClient.kt:471) ~[?:?]
at com.microsoft.graph.httpcore.HttpClients.custom(HttpClients.java:32) ~[?:?]
at com.microsoft.graph.httpcore.HttpClients.createDefault(HttpClients.java:49) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.getHttpClient(BaseClient.java:178) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.getHttpProvider(BaseClient.java:186) ~[?:?]
at com.microsoft.graph.core.BaseClient$Builder.buildClient(BaseClient.java:273) ~[?:?]
at com.microsoft.graph.requests.GraphServiceClient$Builder.buildClient(GraphServiceClient.java:250) ~[?:?]
at org.openhab.binding.microsofttodo.internal.api.MicrosoftToDoApi.<init>(MicrosoftToDoApi.java:56) ~[?:?]
at org.openhab.binding.microsofttodo.internal.handler.MicrosoftToDoBridgeHandler.initialize(MicrosoftToDoBridgeHandler.java:103) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics cannot be found by org.openhab.binding.microsofttodo_3.1.0.202104161347
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:519) ~[org.eclipse.osgi-3.16.200.jar:?] at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:171) ~[org.eclipse.osgi-3.16.200.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
... 21 more
Therefore I tried to add the (according to mavenrepository.com) required kotlin dependencies for okhttp3:
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
</dependency>
This caused my build to fail during the bnd-process
with this log:
[INFO] --- bnd-maven-plugin:5.3.0:bnd-process (default) @ org.openhab.binding.microsofttodo ---
[WARNING] C:\Users\khaun\Git\Projekte\openHAB\openhab-addons-fork\bundles\org.openhab.binding.microsofttodo\pom.xml [0:0]: Unused Export-Package instructions: [org.openhab.*]
[WARNING] C:\Users\khaun\Git\Projekte\openHAB\openhab-addons-fork\bundles\org.openhab.binding.microsofttodo\pom.xml [0:0]: Unused Import-Package instructions: [io.swagger.v3.oas.annotations.*, javax.annotation.security.*, org.eclipse.jdt.annotation.*, com.google.common.*]
[ERROR] C:\Users\khaun\Git\Projekte\openHAB\openhab-addons-fork\bundles\org.openhab.binding.microsofttodo\pom.xml [0:0]: Classes found in the wrong directory: {META-INF/versions/9/module-info.class=module-info}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:37 min
[INFO] Finished at: 2021-04-16T16:13:35+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal biz.aQute.bnd:bnd-maven-plugin:5.3.0:bnd-process (default) on project org.openhab.binding.microsofttodo: Classes found in the wrong directory: {META-INF/versions/9/module-info.class=module-info} -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command mvn clean install -DskipChecks" terminated with exit code: 1.
So I was wondering if anybody else knows a way to get this running by any chance?
I looked into the pom files of other bindings to find some references but it seems like currently there is no binding that has a kotlin requirement?
The closest one I found was the influxdb persistence bundle that uses retrofit:2.5.0 underneath but this artefact does only have an optional kotlin dependency (see https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit/2.5.0).
I would appreciate any help
KG, DarkC