Can't connect to application started from IntelliJ IDEA using JConsole
Hi,
Whe I try to connect JConsole to an application started from IntelliJ, both the JConsole and the application crash.
JConsole gives Exception:
Exception in thread "VMPanel.connect" java.lang.InternalError: Remote thread failed for unknown reason
at sun.tools.attach.WindowsVirtualMachine.enqueue(Native Method)
at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:44)
at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:52)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195)
at sun.tools.jconsole.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:219)
at sun.tools.jconsole.LocalVirtualMachine.startManagementAgent(LocalVirtualMachine.java:83)
at sun.tools.jconsole.ProxyClient.tryConnect(ProxyClient.java:316)
at sun.tools.jconsole.ProxyClient.connect(ProxyClient.java:296)
at sun.tools.jconsole.VMPanel$2.run(VMPanel.java:280)
And the IntelliJ console prints:
"C:\Program Files\Java\jdk1.6.0_25\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 107.52\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.6.0_25\jre\lib\alt-rt.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\alt-string.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunpkcs11.jar;C:\Users\Piotr\Projekty\online-simulator\out\production\online-simulator;C:\Users\Piotr\Projekty\online-simulator\lib\junit-4.7.jar;C:\Users\Piotr\Projekty\online-simulator\lib\scalacheck_2.8.1-1.8.jar;C:\Users\Piotr\Projekty\online-simulator\lib\scalatest-1.2.jar;C:\Users\Piotr\Projekty\online-simulator\lib\specs2_2.9.0.RC1-1.2.jar;C:\Program Files\Scala 2.9\lib\jline.jar;C:\Program Files\Scala 2.9\lib\scala-compiler.jar;C:\Program Files\Scala 2.9\lib\scala-dbc.jar;C:\Program Files\Scala 2.9\lib\scala-library.jar;C:\Program Files\Scala 2.9\lib\scala-swing.jar;C:\Program Files\Scala 2.9\lib\scalap.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 107.52\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain pl.ons.analyzer.RLCTest
Process finished with exit code -1073741819
This problem happens not only when connecting JConsole, but also any other JMX related software, e.g. JVisualVM or jmap.
It happens regardless the application is run on -server or on -client JVM.
Whe I run exactly the same application from command-line java, everything works as it should.
OS: Windows Vista Home Premium SP2
JDK 6u25
IntelliJ IDEA 10.5RC (however I noticed it happened in some previous EAP versions too)
Is it a bug or misconfiguration?
请先登录再写评论。
As for me - in IDEA 10.5RC under JDK7 for Linux x64 everything works fine (I can connect to application started from IDEA).
don'know for sure, but this is probaly because you have already debugging agent specified in the idea.properties. try to comment it out and restart. aslo classpath is quite starange for me. why do all the idea jars there?
The jars are added by the IDEA. I don't know why. They are not listed anywhere in the Project Structure settings (except the standard SDK classpath + my project library jars).
I disabled the idea launcher in the idea.properties and now it just starts the process in a usual way:
"C:\Program Files\Java\jdk1.6.0_25\bin\java" -server -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.6.0_25\jre\lib\alt-rt.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\alt-string.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_25\jre\lib\ext\sunpkcs11.jar;C:\Users\Piotr\Projekty\online-simulator\target\scala_2.9.0.RC3\test-classes;C:\Users\Piotr\Projekty\online-simulator\target\scala_2.9.0.RC3\classes;C:\Users\Piotr\Projekty\online-simulator\project\boot\scala-2.9.0.RC3\lib\scala-compiler.jar;C:\Users\Piotr\Projekty\online-simulator\project\boot\scala-2.9.0.RC3\lib\scala-library.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\asm-3.3.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\asm-analysis-3.3.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\asm-tree-3.3.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\asm-util-3.3.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\hamcrest-all-1.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\junit-4.7.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\mockito-all-1.8.5.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\parboiled-core-0.11.0.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\parboiled-java-0.11.0.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\pegdown-0.9.1.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\scalacheck_2.9.0.RC2-1.9-SNAPSHOT.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\scalacheck_2.9.0.RC3-1.8.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\specs2_2.9.0.RC3-1.3-SNAPSHOT.jar;C:\Users\Piotr\Projekty\online-simulator\lib_managed\scala_2.9.0.RC3\compile\test-interface-0.5.jar" pl.ons.analyzer.RLCTest
starting...
done.
but there problem still remains. I checked the same project under Linux and everything works fine there.
What can I check next?
Ok, so I figured it out. It seems that Windows Vista does something differently when running JConsole from command line than by doubleclicking the exe file directly.
When I run JVisualVM or JConsole by double-clicking a Windows shortcut everything works fine. When I run it from the command line, I get that strange crash after trying to connect.
I doublechecked that I have one and only instance of Java and its tools installed, and exactly the same version of JConsole is run regardless of how it was started. Really strange...
Maybe that's because you run JConsole and your application by different JDKs. I have similar error in Linux when run application under JDK7 and try to connect with JConsole from JDK6.
Nope. That's not it :(
I have only one JDK/JRE installed from the same installation package - Java 6 update 25.
> java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Client VM (build 20.0-b11, mixed mode, sharing)
> jconsole
go to Help -> About JConsole:
JConsole version:
1.6.0_25-b06
Java VM version:
Java HotSpot(TM) Client VM, 20.0-b11
The same JDK is configured in Idea.