apache / apache/shenyu

[Question] <title> shenyu-spring-boot-starter-client-springmvc 2.6.1引入后报Could not initialize class org.apache.shenyu.register.client.http.utils.OkHttpTools

Open
#6,118 3 comments 0 reactions 0 assignees View on GitHub
type: question
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

### Question

主动引人了kotlin-stdlib的包,排掉了shenyu-spring-boot-starter-client-springmvc带的kotlin-stdlib包,也还是不行,辛苦帮忙看下该怎么使用shenyu-spring-boot-starter-client-springmvc 2.6.1
堆栈报错如下:
Exception in thread "shenyu-disruptor-shenyu_disruptor_consumer_-30" Exception in thread "shenyu-disruptor-shenyu_disruptor_consumer_-32" Exception in thread "shenyu-disruptor-shenyu_disruptor_consumer_-33" Exception in thread "shenyu-disruptor-shenyu_disruptor_consumer_-31" java.lang.NoClassDefFoundError: Could not initialize class org.apache.shenyu.register.client.http.utils.OkHttpTools at org.apache.shenyu.register.client.http.utils.RegisterUtils.doLogin(RegisterUtils.java:121) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:98) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:94) at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039) at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doRegister(HttpClientRegisterRepository.java:170) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doPersistInterface(HttpClientRegisterRepository.java:140) at org.apache.shenyu.register.client.api.FailbackRegistryRepository.persistInterface(FailbackRegistryRepository.java:59) at org.apache.shenyu.client.core.disruptor.subcriber.ShenyuClientMetadataExecutorSubscriber.executor(ShenyuClientMetadataExecutorSubscriber.java:51) at org.apache.shenyu.client.core.disruptor.executor.RegisterClientConsumerExecutor.run(RegisterClientConsumerExecutor.java:45) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B at okio.Segment.writeTo(Segment.kt:169) at okio.Segment.compact(Segment.kt:152) at okio.Buffer.write(Buffer.kt:1842) at okio.Buffer.read(Buffer.kt:1854) at okio.Buffer.writeAll(Buffer.kt:1642) at okio.Options$Companion.buildTrieRecursive(Options.kt:187) at okio.Options$Companion.buildTrieRecursive(Options.kt:174) at okio.Options$Companion.buildTrieRecursive$default(Options.kt:113) at okio.Options$Companion.of(Options.kt:72) at okhttp3.internal.Util.(Util.kt:70) at okhttp3.internal.concurrent.TaskRunner.(TaskRunner.kt:309) at okhttp3.ConnectionPool.(ConnectionPool.kt:41) at okhttp3.ConnectionPool.(ConnectionPool.kt:47) at okhttp3.OkHttpClient$Builder.(OkHttpClient.kt:471) at org.apache.shenyu.register.client.http.utils.OkHttpTools.(OkHttpTools.java:47) at org.apache.shenyu.register.client.http.utils.OkHttpTools.(OkHttpTools.java:42) at org.apache.shenyu.register.client.http.utils.RegisterUtils.doLogin(RegisterUtils.java:121) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:98) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:94) at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039) at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doRegister(HttpClientRegisterRepository.java:170) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doPersistInterface(HttpClientRegisterRepository.java:140) at org.apache.shenyu.register.client.api.FailbackRegistryRepository.persistInterface(FailbackRegistryRepository.java:59) at org.apache.shenyu.client.core.disruptor.subcriber.ShenyuClientMetadataExecutorSubscriber.executor(ShenyuClientMetadataExecutorSubscriber.java:51) at org.apache.shenyu.client.core.disruptor.executor.RegisterClientConsumerExecutor.run(RegisterClientConsumerExecutor.java:45) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) java.lang.NoClassDefFoundError: Could not initialize class org.apache.shenyu.register.client.http.utils.OkHttpTools at org.apache.shenyu.register.client.http.utils.RegisterUtils.doLogin(RegisterUtils.java:121) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:98) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:94) at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039) at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doRegister(HttpClientRegisterRepository.java:170) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doPersistInterface(HttpClientRegisterRepository.java:140) at org.apache.shenyu.register.client.api.FailbackRegistryRepository.persistInterface(FailbackRegistryRepository.java:59) at org.apache.shenyu.client.core.disruptor.subcriber.ShenyuClientMetadataExecutorSubscriber.executor(ShenyuClientMetadataExecutorSubscriber.java:51) at org.apache.shenyu.client.core.disruptor.executor.RegisterClientConsumerExecutor.run(RegisterClientConsumerExecutor.java:45) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) java.lang.NoClassDefFoundError: Could not initialize class org.apache.shenyu.register.client.http.utils.OkHttpTools at org.apache.shenyu.register.client.http.utils.RegisterUtils.doLogin(RegisterUtils.java:121) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:98) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository$1.load(HttpClientRegisterRepository.java:94) at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.lambda$new$0(BoundedLocalCache.java:3366) at com.github.benmanes.caffeine.cache.BoundedLocalCache.lambda$doComputeIfAbsent$14(BoundedLocalCache.java:2039) at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1908) at com.github.benmanes.caffeine.cache.BoundedLocalCache.doComputeIfAbsent(BoundedLocalCache.java:2037) at com.github.benmanes.caffeine.cache.BoundedLocalCache.computeIfAbsent(BoundedLocalCache.java:2020) at com.github.benmanes.caffeine.cache.LocalCache.computeIfAbsent(LocalCache.java:112) at com.github.benmanes.caffeine.cache.LocalLoadingCache.get(LocalLoadingCache.java:67) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doRegister(HttpClientRegisterRepository.java:170) at org.apache.shenyu.register.client.http.HttpClientRegisterRepository.doPersistInterface(HttpClientRegisterRepository.java:140) at org.apache.shenyu.register.client.api.FailbackRegistryRepository.persistInterface(FailbackRegistryRepository.java:59) at org.apache.shenyu.client.core.disruptor.subcriber.ShenyuClientMetadataExecutorSubscriber.executor(ShenyuClientMetadataExecutorSubscriber.java:51) at org.apache.shenyu.client.core.disruptor.executor.RegisterClientConsumerExecutor.run(RegisterClientConsumerExecutor.java:45) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dependency versions used by shenyu-spring-boot-starter-client-springmvc 2.6.1 and inspect org.apache.shenyu.register.client.http.utils.OkHttpTools, RegisterUtils.doLogin, and the OkHttp/Okio stack shown in the report. Reproduce the starter startup failure and determine the dependency alignment needed for registration to initialize without NoSuchMethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.