Java – why doesn’t visualvm profiler configure my Scala console application?

I think this problem is closely related to this problem, but it has been closed, and the solution seems unclear to me

I'm trying to configure my console Scala application using visualvm I do this by starting visualvm, starting my Scala application, opening its node in visualvm, going to the profiler tab and clicking CPU The button turns gray for a period of time (the status will never change to "analysis inactive"), and then returns to the active status, but no analysis data is displayed

The application performs some file reading, data processing (about one minute), stdout data output and exit I also tried to thread Sleep (60000) is added to the beginning and end of the program to ensure that there is enough time for visual VM to capture it and complete the work, but there is no change

Unlike the related questions I linked, I didn't launch my application from eclipse or anything else – I started it using the following command line:

java -classpath myapp.jar:lib/* MyApp.Main

All libraries (including Scala - library. Jar) are placed in lib / The application works as expected

to update:

>I've tried yourkit Java profiler 11.0 2. It failed due to attachnotsupportedexception. > I used yourkit for management before attaching the agent manually. > It seems worth emphasizing that I neither run the application from the IDE (or build tool), nor modify any JVM options, but modify the classpath As far as I know, this problem seems to depend on the JVM version and user / permission issues The goal is to find out the actual mechanism of the problem and how to configure all work

Software version used:

> YourKit Java Profiler 11.0. 2 > VisualVM 1.3. 4 > SBT 0.12. 3 (build but not run (I've actually tried)) > Scala 2.9 2 > Oracle Java 1.7. 0_ 04-b20 > Ubuntu Linux 12.04 32-bit i386 > linux kernel 3.2 0-24-generic-pae

resolvent

Solution

I used visual VM to analyze Scala applications two days ago, so I believe it should be feasible Here are my suggestions:

>Take youkit out of the equation and run the initiator without it > take Scala out of the equation and try to analyze a Java Hello World executing while (true) {thread. Sleep (10000);} > Let it work, then put it back in Scala, and then put it back in yourkit

Edit: Based on your input, I recommend explicitly setting up a remote JMX connection You can start java with the following options:

-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=20000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false

Then, in visual VM, add the JMX connection to localhost: 20000

The above is the Java collected by programming house for you – why doesn't visualvm profiler configure my Scala console application? I hope this article can help you solve Java - why doesn't visualvm profiler configure my Scala console application? Program development problems encountered.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>