Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load HotSpot VM #1718

Open
glcanvas opened this issue Oct 12, 2024 · 1 comment
Open

Failed to load HotSpot VM #1718

glcanvas opened this issue Oct 12, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@glcanvas
Copy link

Hello!
getting error while using mockK:

java.lang.ExceptionInInitializerError
at io.mockk.MockKKt.clearAllMocks(MockK.kt:1630)
at ru.tinkoff.kora.test.extension.junit5.MockUtils.resetIfMock(MockUtils.java:44)
at ru.tinkoff.kora.test.extension.junit5.KoraJUnit5Extension.prepareMocks(KoraJUnit5Extension.java:187)
at ru.tinkoff.kora.test.extension.junit5.KoraJUnit5Extension.beforeEach(KoraJUnit5Extension.java:292)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@5e2975ca
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:643)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:616)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:568)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:545)
at io.mockk.proxy.jvm.JvmMockKAgentFactory.initInstrumentation(JvmMockKAgentFactory.kt:127)
at io.mockk.proxy.jvm.JvmMockKAgentFactory.init(JvmMockKAgentFactory.kt:33)
at io.mockk.impl.JvmMockKGateway.(JvmMockKGateway.kt:46)
at io.mockk.impl.JvmMockKGateway.(JvmMockKGateway.kt:185)
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at net.bytebuddy.agent.Attacher.install(Attacher.java:102)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:638)
... 13 more
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /var/folders/d8/j56110ys0d3dctj82mycjbxm0000gn/T/.java_pid7149: target process 7149 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.(VirtualMachineImpl.java:99)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
... 16 more

Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@5e2975ca
java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@5e2975ca
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:643)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:616)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:568)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:545)
at io.mockk.proxy.jvm.JvmMockKAgentFactory.initInstrumentation(JvmMockKAgentFactory.kt:127)
at io.mockk.proxy.jvm.JvmMockKAgentFactory.init(JvmMockKAgentFactory.kt:33)
at io.mockk.impl.JvmMockKGateway.(JvmMockKGateway.kt:46)
at io.mockk.impl.JvmMockKGateway.(JvmMockKGateway.kt:185)
at io.mockk.MockKKt.clearAllMocks(MockK.kt:1630)
at ru.tinkoff.kora.test.extension.junit5.MockUtils.resetIfMock(MockUtils.java:44)
at ru.tinkoff.kora.test.extension.junit5.KoraJUnit5Extension.prepareMocks(KoraJUnit5Extension.java:187)
at ru.tinkoff.kora.test.extension.junit5.KoraJUnit5Extension.beforeEach(KoraJUnit5Extension.java:292)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at net.bytebuddy.agent.Attacher.install(Attacher.java:102)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:638)
... 13 more
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /var/folders/d8/j56110ys0d3dctj82mycjbxm0000gn/T/.java_pid7149: target process 7149 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.(VirtualMachineImpl.java:99)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
... 16 more
Launched on Apple M3 Pro.

Have tried with jvm22, 21, 17

Launched from Idea and from console:
./gradlew :test --tests "path.to.Test"

Both launches give same error

@raphw
Copy link
Owner

raphw commented Oct 12, 2024

It seems like the JVM you are using does not support dynamic attach. You can add -javaagent:/path/to/bytebuddy.jar to the VM command line to avoid the need for dynamic attach.

@raphw raphw self-assigned this Oct 12, 2024
@raphw raphw added the question label Oct 12, 2024
@raphw raphw added this to the 1.15.4 milestone Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants