Closed yourganesan closed 9 years ago
More to the story... the issue happens only when the server is built/deployed/started using openjdk.. and works with oracle jdks.. any quick help will be greatly appreciated.. Here is some more stack trace..
java.lang.RuntimeException: com.sun.tools.attach.AgentLoadException: Agent JAR not found or no Agent-Class attribute
19:09:42,185 ERROR stderr at mockit.internal.startup.AgentLoader.loadAgentAndDetachFromThisVM(AgentLoader.java:115)
19:09:42,186 ERROR stderr at mockit.internal.startup.AgentLoader.loadAgent(AgentLoader.java:54)
19:09:42,186 ERROR stderr at mockit.internal.startup.AgentInitialization.loadAgentFromLocalJarFile(AgentInitialization.java:27)
19:09:42,186 ERROR stderr at mockit.internal.startup.Startup.initializeIfPossible(Startup.java:252)
19:09:42,186 ERROR stderr at mockit.integration.testng.Initializer.
If the JRE from OpenJDK does not support dynamic agent loading (which is normally done by JMockit), then you will have to start the JVM with the "-javaagent:
Hi Thanks for the reply, In our project, adding the jmockit as an agent is not an option. and i am helpless.. can you kindly help me any other alternative way?
FYI.. you can have a look at the below thread which discusses the same issue when using jmockit with open jdk.. Though the context is different, if you read all the comments completely, then we can detect that the jmockit does not initialize well in open jdk context.. A solution (other than adding it as agent) is needed in time. please help me..
https://groups.google.com/forum/#!topic/java-pathfinder/i5c62gMkk5o
Ok. I see no useful info in that thread, though.
What I need to know is the following: 1) What is the version of OpenJDK being used? For which OS? 2) Where does the OpenJDK binaries come from? Some site with downloadable binaries, or did you build it yourself? 3) Does the "jre/bin" directory in the OpenJDK installation contain the "attach" native library file?
Thanks for reopening this. Here is the requested information 1) What is the version of OpenJDK being used? For which OS? - OpenJDK7-45 and RHEL 6.5 2) Where does the OpenJDK binaries come from? Some site with downloadable binaries, or did you built it yourself? - We installed openjdk as mentioned here http://openjdk.java.net/install/index.html 3) Does the "jre/bin" directory in the OpenJDK installation contain the "attach" native library file? - No, but it has /jre/lib/amd64/libattach.so file. Does this information help?
Thanks for the support and appreciate your quick response in resolving this issue.
I suspect your JRE does not contain the attach library (if it did, should be "jre/bin/attach.so", not "jre/lib/libattach.so"). In the "OpenJDK: Download and install" page, it says: "The java-1.7.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.7.0-openjdk-devel package."
Plain JREs indeed do not contain the Attach API library; you need the JRE from a JDK. So, the likely solution here is to use the "java-1.7.0-openjdk-devel" package.
Hi we have used java-1.7.0-openjdk-devel" package only and still there is no attach.so under jre/bin directory.. let me know if you need any more information.
Nothing more I can do, I am afraid, as I don't currently have a Linux system available for testing.
Hi, i can test it with my linux system if that is what is stopping now. is it okay?
Sure, you can test it. What I would do is to run a single test using the mocking API, with a breakpoint on the first line containing a "new Expectations() ..." statement or similar; then step through the initialization methods in class mockit.internal.Startup etc.
Hi I am getting the below error when starting my server with jmockit-1.9.jar in classpath. Any idea how to resolve this? I am using junit-4.5.jar, testng-6.7.jar and jmockit-1.9.jar. and I have ensure that jmockit jar appears before the junit and testng in the classpath
^[[0m^[[31m14:35:58,932 ERROR stderr java.lang.RuntimeException: com.sun.tools.attach.AgentLoadException: Agent JAR not found or no Agent-Class attribute ^[[0m^[[31m14:35:58,933 ERROR stderr at mockit.internal.startup.AgentLoader.loadAgentAndDetachFromThisVM(AgentLoader.java:115