小编Léo*_*der的帖子

如何修复调试中的 ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain?

我正在运行几个项目作为 Spring Boot 应用程序,其中一个项目特别无法启动并抛出:

java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
    at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
Disconnected from the target VM, address: '127.0.0.1:64279', transport: 'socket'

Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)

命令行有选项:

-javaagent:[...].m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.5.0/kotlinx-coroutines-core-1.5.0.jar
Run Code Online (Sandbox Code Playgroud)

这个罐子是存在的。

将我的 Intellij'Idea 更新到 2021.2 后发生这种情况

此问题仅在调试模式下发生。

知道如何解决这个问题吗?

intellij-idea kotlin

21
推荐指数
2
解决办法
9764
查看次数

由于 java.lang.IllegalStateException,无法构建 Spring webClient:找不到合适的默认 ClientHttpConnector

我想WebClient在我的服务类中使用特定的。我在构建它时遇到了这个异常:

看起来这是一个依赖问题,但一个很好的旧干净安装没有改变任何东西。

我需要在我的配置中手动指定一个 Bean 吗?

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.***.Client]: Constructor threw exception; nested exception is java.lang.IllegalStateException: No suitable default ClientHttpConnector found
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:213)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:310)
        ... 122 more
    Caused by: java.lang.IllegalStateException: No suitable default ClientHttpConnector found
        at org.springframework.web.reactive.function.client.DefaultWebClientBuilder.getOrInitConnector(DefaultWebClientBuilder.java:266)
        at org.springframework.web.reactive.function.client.DefaultWebClientBuilder.build(DefaultWebClientBuilder.java:244)
        at com.***.Client.<init>(Client.kt:35)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at kotlin.reflect.jvm.internal.calls.CallerImpl$Constructor.call(CallerImpl.kt:41)
        at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:106)
        at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:152)
        at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:110)
        at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:788)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:185)
Run Code Online (Sandbox Code Playgroud)

我的课很简单:

@Service
class Client {
    private val webClient = WebClient.builder() …
Run Code Online (Sandbox Code Playgroud)

kotlin spring-boot

12
推荐指数
2
解决办法
6520
查看次数

标签 统计

kotlin ×2

intellij-idea ×1

spring-boot ×1