Failure when trying to run Gradle: Can not attach to current VM

Answered

After few weeks without running the IDE, I just came across to the follow error when trying to run a simple test:

 

"/Applications/IntelliJ IDEA.app/Contents/jbr/Contents/Home/bin/java" -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55457:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/uilian/Development/conan/c3i_jenkins/out/test/classes:/Users/uilian/Development/conan/c3i_jenkins/out/production/classes:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.spockframework/spock-core/1.2-groovy-2.4/799953495449acd81af8670a9bdf60987067fa88/spock-core-1.2-groovy-2.4.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.15/423a17aeb2f64bc6f76e8e44265a548bec80fd42/groovy-all-2.4.15.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.cloudbees/groovy-cps/1.22/32c18d0db0efd86f5d3bbf85d5a23d631a1e471d/groovy-cps-1.22.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.jfrog.artifactory.client/artifactory-java-client-services/2.10.0/236e11adbd15999f839acd6dc348ac6ae1501da4/artifactory-java-client-services-2.10.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/1.8/acfe93f81278f58f62e035f8ca2ca6abb0a5cb8e/snakeyaml-1.8.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.kohsuke.stapler/json-lib/2.4-jenkins-2/7f4f9016d8c8b316ecbe68afe7c26df06d301366/json-lib-2.4-jenkins-2.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/0.9.26/42253815f22c35f3a9b9a34fd0feca62eec8c78e/logback-classic-0.9.26.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.lesfurets/jenkins-pipeline-unit/1.10/6bc4316c8f08e0cdb3b4d347f0df810594f76ab0/jenkins-pipeline-unit-1.10.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/io.github.java-diff-utils/java-diff-utils/4.7/3da458ae5602ed7a5e321e7c9dec747d142247a6/java-diff-utils-4.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-api-mockito2/2.0.7/9f40156d9f6f65c6459a65e34f3c7c4fef8b3c49/powermock-api-mockito2-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.mockito/mockito-core/3.5.7/9ffa374a5b2a7c7cc0431a254c8e7f40a85cc88e/mockito-core-3.5.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-module-junit4/2.0.7/e872237afe86c1a52dae46b2e1d0ed45040a3f0/powermock-module-junit4-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-module-junit4-rule-agent/2.0.7/d275ae972efd4cd3aadff96d15d283884b2f303b/powermock-module-junit4-rule-agent-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/junit/junit/4.13.1/cdd00374f1fee76b11e2a9d127405aa3f6be5b6a/junit-4.13.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/11.0.1/57b40a943725d43610c898ac0169adf1b2d55742/guava-11.0.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.jfrog.artifactory.client/artifactory-java-client-api/2.10.0/aa379eb62b45ff891734c32a35c1d2ee91e30c93/artifactory-java-client-api-2.10.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.jfrog.artifactory.client/artifactory-java-client-httpClient/2.10.0/bf3dff49dd6e30c663ed0fffb06073c3a8481f39/artifactory-java-client-httpClient-2.10.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.5.13/e5f6cae5ca7ecaac1ec2827a9e2d65ae2869cada/httpclient-4.5.13.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.13/3f18e1aa31031d89db6f01ba05d501258ce69d2c/commons-codec-1.13.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.12.0/c6842c86792ff03b9f1d1fe2aab8dc23aa6c6f0e/commons-lang3-3.12.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.12.6/9487231edd6b0b1f14692c9cba9e0462809215d1/jackson-annotations-2.12.6.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.12.6/fac216b606c1086e36acea6e572ee61572ad1670/jackson-databind-2.12.6.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.12.6/5bf206c0b5982cfcd868b3d9349dc5190db8bab5/jackson-core-2.12.6.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.jfrog.filespecs/file-specs-java/1.1.1/352f2a5b9018beac6755b295f43db4555e03ae2a/file-specs-java-1.1.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy/2.4.21/abbb8d83268f3243a57d9f7768e159373a4e378/groovy-2.4.21.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.slf4j/log4j-over-slf4j/1.7.32/152d3b5e2470bb8e898bd82886fc783361e2c32b/log4j-over-slf4j-1.7.32.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.slf4j/jcl-over-slf4j/1.7.32/32c060250bcc5282cdbc1fd7008c12eb4ebad00e/jcl-over-slf4j-1.7.32.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.32/cdcff33940d9f2de763bc41ea05a0be5941176c3/slf4j-api-1.7.32.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.8.0/92999e26e6534606b5678014e66948286298a35c/commons-io-2.8.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-beanutils/commons-beanutils/1.8.0/c651d5103c649c12b20d53731643e5fffceb536/commons-beanutils-1.8.0.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/761ea405b9b37ced573d2df0d1e3a4e0f9edc668/commons-collections-3.2.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/net.sf.ezmorph/ezmorph/1.0.6/1e55d2a0253ea37745d33062852fd2c90027432/ezmorph-1.0.6.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.5/b0236b252e86419eef20c31a44579d2aee2f0a69/commons-lang-2.5.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/0.9.26/abfae9ea939198c4c708f860ee58f7647f8936de/logback-core-0.9.26.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.assertj/assertj-core/3.4.1/536893abdf1ce11f72c1e4483a88e94d6ba80005/assertj-core-3.4.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.9.RELEASE/400a6fdb45bfa5318aa7d06360f4495b75080bb5/spring-core-5.2.9.RELEASE.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-api-support/2.0.7/e311918de98f5d8b726031ca840664691599fd71/powermock-api-support-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.10.13/1426b15be5954246a9a72fd4baae1f42b9a4f45d/byte-buddy-1.10.13.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy-agent/1.10.13/f5b939963d13be46c101a3c12bf49aa23abb191/byte-buddy-agent-1.10.13.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.objenesis/objenesis/3.1/48f12deaae83a8dfc3775d830c9fd60ea59bbbca/objenesis-3.1.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-module-junit4-common/2.0.7/e890f92292aa525000a8fa95a8ca4015e3eb78b8/powermock-module-junit4-common-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-module-javaagent/2.0.7/c529897f555e1a8b09a037c688a9db110ccf93c2/powermock-module-javaagent-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-core/2.0.7/484c06b406c5a21a4a2ad39f6fe36a0f77834aa9/powermock-core-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/1.3.9/40719ea6961c0cb6afaeb6a921eaa1f6afd4cfdf/jsr305-1.3.9.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.13/853b96d3afbb7bf8cc303fe27ee96836a10c1834/httpcore-4.4.13.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/5.2.9.RELEASE/39777c3eeaf3d0957d9fdffbb75e3ff8a89caf62/spring-jcl-5.2.9.RELEASE.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.powermock/powermock-reflect/2.0.7/9a8b85397c5a72923962ee9e6bf774e8458803bb/powermock-reflect-2.0.7.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.27.0-GA/f63e6aa899e15eca8fdaa402a79af4c417252213/javassist-3.27.0-GA.jar:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.apache.ivy/ivy/2.4.0/5abe4c24bbe992a9ac07ca563d5bd3e8d569e9ed/ivy-2.4.0.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 test_src.org.jfrog.c3i.pullRequest.BumpDependenciesTest,Bump dependencies when comments does not change
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/Users/uilian/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.4.15/423a17aeb2f64bc6f76e8e44265a548bec80fd42/groovy-all-2.4.15.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.RuntimeException: java.io.IOException: Can not attach to current VM
    at org.powermock.modules.agent.AgentLoader.attachToThisVM(AgentLoader.java:140)
    at org.powermock.modules.agent.AgentLoader.loadAgent(AgentLoader.java:87)
    at org.powermock.modules.agent.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:40)
    at org.powermock.modules.agent.PowerMockAgent.initializeIfNeeded(PowerMockAgent.java:91)
    at org.powermock.modules.agent.PowerMockAgent.initializeIfPossible(PowerMockAgent.java:105)
    at org.powermock.modules.junit4.rule.PowerMockRule.<clinit>(PowerMockRule.java:40)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:242)
    at test_src.org.jfrog.c3i.pullRequest.BumpDependenciesTest.$spock_initializeFields(BumpDependenciesTest.groovy:40)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.spockframework.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:200)
    at org.spockframework.runtime.model.MethodInfo.invoke(MethodInfo.java:113)
    at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484)
    at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467)
    at org.spockframework.runtime.BaseSpecRunner.doRunInitializer(BaseSpecRunner.java:364)
    at org.spockframework.runtime.BaseSpecRunner$7.invoke(BaseSpecRunner.java:348)
    at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484)
    at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467)
    at org.spockframework.runtime.BaseSpecRunner.runInitializer(BaseSpecRunner.java:341)
    at org.spockframework.runtime.BaseSpecRunner.runInitializer(BaseSpecRunner.java:336)
    at org.spockframework.runtime.BaseSpecRunner.initializeAndRunIteration(BaseSpecRunner.java:274)
    at org.spockframework.runtime.BaseSpecRunner.runSimpleFeature(BaseSpecRunner.java:266)
    at org.spockframework.runtime.BaseSpecRunner.doRunFeature(BaseSpecRunner.java:260)
    at org.spockframework.runtime.BaseSpecRunner$5.invoke(BaseSpecRunner.java:243)
    at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484)
    at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467)
    at org.spockframework.runtime.BaseSpecRunner.runFeature(BaseSpecRunner.java:235)
    at org.spockframework.runtime.BaseSpecRunner.runFeatures(BaseSpecRunner.java:185)
    at org.spockframework.runtime.BaseSpecRunner.doRunSpec(BaseSpecRunner.java:95)
    at org.spockframework.runtime.BaseSpecRunner$1.invoke(BaseSpecRunner.java:81)
    at org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:484)
    at org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:467)
    at org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:73)
    at org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:64)
    at org.spockframework.runtime.Sputnik.run(Sputnik.java:63)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.io.IOException: Can not attach to current VM
    at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.<init>(HotSpotVirtualMachine.java:75)
    at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:56)
    at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
    at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
    at org.powermock.modules.agent.AgentLoader.attachToThisVM(AgentLoader.java:136)

 

  1.  I already configured `jdk.attach.allowAttachSelf=true` on Preferences/Build,Execution,Deployment/Build Tools/Maven/Runner/Properties
  2.  I'm running jbr-11 (Jetbrains Runtime version 11.0.15
  3. I'm using Mac M1 OSX 12.6
  4. I already tried with Orancle OpenJDK 17.0.2, but same result

 

No idea how to find some clue about that error and a possible solution.

2 comments
Comment actions Permalink

Hi Uilian - please provide:

  • the contents of the Help | About window.
  • a screenshot of the run/debug configuration of the test that you are running. Run | Edit Configurations
  • idea.log file collected after reproducing the issue. Help | Show Log in... (you can upload it privately to https://uploads.jetbrains.com and provide the upload id here)
0
Comment actions Permalink
Hi Uilian - please provide: * the contents of the **Help | About** window. * a screenshot of the run/debug configuration of the test that you are running. **Run | Edit Configurations** * _idea.log_ file collected after reproducing the issue. **Help | Show Log in...** (you can upload it privately to https://uploads.jetbrains.com and provide the upload id here)
0

Please sign in to leave a comment.