I assume the question is strongly related to this one but it is closed and the solution does not seem clear to me.
I am trying to use VisualVM to profile a console Scala application of mine. 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 goes grey for some time (while status never changes to anything from "profiling inactive"), then back active but no profiling data appears shown.
The application does some file reading, data processing (which takes about a minute), stdout data output and exits. I've also tried adding Thread.sleep(60000)
to the beginning and to the end of the program to ensure enough time for VisualVM to capture it and do the job, nothing changed though.
Unlike to the related question I've linked to I don't launch my app from Eclipse or anything else - I use the following command line to launch it:
java -classpath myapp.jar:lib/* MyApp.Main
all the libraries (including scala-library.jar
) are put in lib/
. The app works as expected.
Updates:
- I have tried YourKit Java Profiler 11.0.2 and it fails with
AttachNotSupportedException
. - I've managed with YourKit by attaching the agent manually.
- It seems worth stressing that I neither run the application from an IDE (or a build tool) nor have I modified any JVM options but classpath. As far as I understand this problem appears to depend on a JVM version and user/permission issues and. The objective is to figure out the actual mechanism of the problem and the way to configure all the things to work.
Versions of the software used:
- YourKit Java Profiler 11.0.2
- VisualVM 1.3.4
- SBT 0.12.3 (to build but not to run (I've tried both actually))
- Scala 2.9.2
- Oracle Java 1.7.0_04-b20
- XUbuntu Linux 12.04 32-bit i386
- Linux kernel 3.2.0-24-generic-pae