Closed stepancheg closed 9 years ago
@stepancheg I recently changed the directory structure. Can you try to git clean
the project and then run cmake . && make
again? This should put build artifacts into out
.
I did build in clean checkout, it didn't help.
Problem must be in cmake. Seems like CMake 2.8 which I use doesn't understand OUTPUT_DIR
option. I bet you have newer version?
Not sure about that:
> cmake --version
cmake version 2.8.12.2
I'm on Ubuntu 14.04.3 btw.
I'm having the same problem with cmake version 2.8.11
on CentOS 7.0.1406
Is "the same problem", that attach-main.jar
gets copied to the root directory of the project?
indeed
Can you try if adding this line to CMakeLists.txt
helps:
set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${OUTDIR})
Yep, it seems it did the trick! Thanks!
[simulator@localhost perf-map-agent]$ git diff CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8bcebbf..98e5832 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,7 @@ project (perf-map-agent)
# Binaries (agent libperfmap.so and attach-main.jar) will end up in ./out
set(OUTDIR ${PROJECT_BINARY_DIR}/out)
set(LIBRARY_OUTPUT_PATH ${OUTDIR})
+set(CMAKE_JAVA_TARGET_OUTPUT_DIR ${OUTDIR})
find_package(JNI)
if (JNI_FOUND)
Cool, thanks for verifying.
no problem. Thanks for your work on this!
FYI I got the same error
Error: Could not find or load main class net.virtualvoid.perf.AttachOnce
In my case it was due to the fact that the user that was being su'ed to (ie the user that owned the java process being attached to) did not have access to the directory where the software was installed.
Hi Team,
Even i got the same error "Error: Could not find or load main class net.virtualvoid.perf.AttachOnce" I could see the files attach-main.jar and libperfmap.so in out directory. but still it fails. I am running the attach command as user who owns the java process inside the docker container java -cp attach-main.jar:$JAVA_HOME/lib/tools.jar net.virtualvoid.perf.AttachOnce 5063
Any help greatly appreciated.
Thanks Sattish
@sattishv see issue #50 for tips on running inside Docker.
@donsi I think I have the same issue. I have tomcat running my Java app and I get the error. How did you resolve your issue?
@Liron24 my issue was that the user that the java process (eg tomcat) was running under did not have access to the directory where perf-map-agent was installed. Ensuring that the user had access fixed the problem for me.
@donsi thank you. Now I'm getting the following: Exception in thread "main" java.lang.UnsupportedClassVersionError: net/virtualvoid/perf/AttachOnce : Unsupported major.minor version 52.0
Did you come across such error?
Sorry @Liron24 I don't recall getting that error.
Hi @Liron24,
Seems like you build perf-map-agent
with Java 8 and run your tomcat application on Java prior this version. I suggest you check your java versions and align them. However, I don't remember required Java version for map-agent though. Hope it helps.
@alex-dukhno thank you for the response, do you know how can change the Java version for the perf-map-agent?
@Liron24 I haven't built perf-map-agent in a while, but I assume that you can change Java with JAVA_HOME
as pointed in Readme file build section.
You need to install your's tomcat JDK version on your machine and change JAVA_HOME
.
Or, if it is possible, check out git repo onto your's tomcat machine and build agent their.
@alex-dukhno Thank you!
scripts expects
attach-main.jar
to be found inout
dir, while it is in the project root dir.