Error occurred during initialization of vm agent library failed to init instrument

All the prepare step i have done,then i run my java application,and i set the VM arguments like this: -javaagent:JavaMOPAgent.jar and then get this issue Error occurred during initialization of VM ...

@MichaelMeng666

All the prepare step i have done,then i run my java application,and i set the VM arguments like this:
-javaagent:JavaMOPAgent.jar
and then get this issue

Error occurred during initialization of VM
agent library failed to init: instrument
Error opening zip file or JAR manifest missing : JavaMOPAgent.jar

if VM arguments are prepared as : -javaagent:E:workspacetest1srccomluoJavaMOPAgent.jar
the errors will be

java.lang.ClassNotFoundException: org.aspectj.weaver.loadtime.Agent
FATAL ERROR in native method: processing of -javaagent failed
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Exception in thread «main»

please help me.

@owolabileg

For the first option it looks like you are not running your java command from the directory that contains the JavaMOPAgent.jar file. For the second option, it looks like you are missing aspectjweaver.jar and rv-monitor-rt.jar from your classpath.

@MichaelMeng666

Thank you for replying. I ensure that they have been configured in my classpath ,but it still errors like this:
java.lang.ClassNotFoundException: org.aspectj.weaver.loadtime.Agent.
FATAL ERROR in native method: processing of -javaagent failed
Should I need to configure the agent server or change my other configuration in Eclipse? like Tomcat server configuration or agent server IP and port in VM argument textbox?

@MichaelMeng666

There is a weird question. When I build a agent on a Unix-like system, there is also an error occurred that the aspectjweaver.jar missing. But I check my classpath or the aspectJ folder, it is exists! I can’t understand why.Have you ever had this problem?

@MichaelMeng666

This is my classpath : C:aspectj1.8libaspectjrt.jar;C:aspectj1.8libaspectjtools.jar;C:aspectj1.8libaspectjweaver.jar;C:aspectj1.8liborg.aspectj.matcher.jar;C:RV-Monitorlibrv-monitor-rt.jar;C:RV-Monitorlibrv-monitor.jar;C:RV-Monitorlibaspectjweaver.jar;%RV-Monitor%liblogicrepository.jar; %JAVA_HOME%libdt.jar; %JAVA_HOME%libtools.jar;
This is part of my path:
%JAVA_HOME%bin;%JAVA_HOME%jrebin;C:aspectj1.8bin;%RV-Monitor%bin;D:Program FilesTortoiseGitbin;C:Program Filesjavamopbin;d:Program FilesGitcmd;C:apache-maven-3.3.9bin;

@owolabileg

  1. What is the full command that you run to build the agent?
  2. Can you post a set of steps that I may follow to reproduce this problem?
  3. In your UNIX-like environment, what does echo $CLASSPATH give you?

@MichaelMeng666

On windows:
1.git clone
2.mvn package
3.cd workspace/test1/src/com
4.javamop -keepRVFiles HasNext.mop
5.rv-monitor -merge -d classes/mop/ HasNext.rvm
6.javac classes/mop/HasNextRuntimeMonitor.java
7.delete the HasNextRuntimeMonitor.java
8.javamopagent HasNextMonitorAspect.aj classes -n JavaMOPAgent -excludeJars
Finally I set the VM arguments in Eclipse like this:
-javaagent:JavaMOPAgent.jar
and then get the issue.
java.lang.ClassNotFoundException: org.aspectj.weaver.loadtime.Agent.
FATAL ERROR in native method: processing of -javaagent failed

On Ubuntu(get in touch with this type system for the first time):
When it goes to the step 8, it apperces:
aspectjtools.jar is missing from the classpath. Halting.

$CLASSPATH
bash: .:/usr/local/aspectj1.8/lib/aspectjrt.jar:/usr/local/java/jdk1.8.0_121/lib:/usr/local/java/jdk1.8.0_121/jre/lib:/usr/local/aspectj1.8/lib/aspectjweaver.jar:/usr/local/java/aspectj1.8/lib/aspectjtools.jar:/usr/local/aspectj1.8/lib/org.aspectj.matcher.jar:/usr/local/RV-Monitor/lib/rv-monitor.jar:/usr/local/RV-Monitor/lib/rv-monitor-rt.jar:/usr/local/RV-Monitor/lib/aspectjweaver.jar::

@MichaelMeng666

Sorry to bother you, I understand why it is. Thank you for reading my comments。

@owolabileg

Glad to hear that you got this to work. Would you mind to share what the problem was and how you fixed it? Thanks!

@MichaelMeng666

5.rv-monitor -merge -d classes/mop/ HasNext.rvm
6.javac classes/mop/HasNextRuntimeMonitor.java
The generated file is missing the BaseAspect.class file, I get the file by the static weaving using AspectJ finally.

@donlaiq

A question about this topic. I’m trying to run a project implementing a load time weaving with AspectJ. I’m using STS and if I’m not wrong I should modify the VM arguments of the Run Configurations windows with something like this «-javaagent:aspectjweaver-1.8.8.jar».
This jar file seems to be in the classpath of the project (not the classpath of the OS), but I’m getting this error
«Error opening zip file or JAR manifest missing : aspectjweaver-1.8.8.jar».
Is it possible to use a relative path when I reference the agent or should I use an absolute path?

@owolabileg

@donlaiq is this a JavaMOP-related question? I don’t understand what you mean by I'm trying to run a project implementing a load time weaving with AspectJ.

@donlaiq

No, it’s not about JavaMOP. It’s about AspectJ Weaver, a load-time weaver.
I don’t know if there’s a way to reference this weaver using a relative path or if there’s no choice but using an absolute path.
It’s the same error, trying to use javaagent within the Eclipse IDE, but with a different jar file, aspectjweaver.jar instead of JavaMOPAgent.jar.

@LizzyMiao

Error opening zip file or JAR manifest missing : aspectjweaver-1.8.8.jar

same happen to me, how did you solve this?

@MichaelMeng666

How do I troubleshoot installation and startup errors when installing a new Agent?

Table of Contents

  • Agent Installation Errors
    • When installing a Machine Agent, how do I handle an initialization error?
    • Can I install the AppDynamics Database Agent without using the wizard?
    • I’m having trouble installing a PHP Agent. What steps should I take?
  • Agent Upgrade Considerations 
    •  What are the steps to upgrade a Mobile Agent?
    • Where can I find information on how to upgrade an Agent? 
  • Resolving Agent Start-up Errors
    • How do I resolve the Analytics Agent failure to start, with a NoSuchMethod error message?
    • My Analytic Agent fails to start and logs show it failed to connect to the Controller endpoint
  • More Troubleshooting Guides

When installing a Machine Agent, how do I handle an initialization error? 

I get the following error message when installing a Machine Agent. How should I proceed? 

Failed to find Premain-Class manifest attribute in /usr/share/appdynamics/machineagent.jar
Error occurred during initialization of VM

The error message shows that the Machine Agent jar was used as a Java Agent.

>java -javaagent:d:AppDynamicsinstalls3.5.6MachineAgentmachineagent.jar -version
Failed to find Premain-Class manifest attribute in d:AppDynamicsinstalls3.5.6MachineAgentmachineagent.jar
Error occurred during initialization of VM.  Agent library failed to init: instrument
  1. Verify the command being used to start the Machine Agent.
  2. Follow the documentation to Install the Machine Agent. 
  3. Open a separate command prompt and start the Machine Agent using java -Dmetric.http.listener=true -jar machineagent.jar command.

Can I install the AppDynamics Database Agent without using the wizard?

Question:

Is there a way to install the AppDynamics database agent without the wizard, such as configuring the installation XML files? I want to monitor a client but am having trouble when installing the Agent. I cannot log in to the DB from outside the network and opening up the listener port on the DB for me right now is an issue. Is there a workaround?

You do not necessarily have to install the Database Agent on the database server. The Database Agent can reside on any server as long as that server can communicate to the database host. See Database Visibility System Requirements. 

I’m having trouble installing a PHP Agent. What steps should I take?

After PHP Agent installation there are a few cases when the Agent does not report to the Controller. Refer to the PHP Agent installation troubleshooting guide for the basic troubleshooting steps that verify the installation and place the Agent configuration files in the proper place. 

Is it possible to deploy an agent using Puppet?

Every deployment is different,  so this task doesn’t lend itself to a single master Puppet script maintained by AppDynamics. However, this Agent deployment using Puppet sample can help you get started on your own Puppet module.

Back to  Table of Contents


Agent Upgrade Considerations

 What are the steps to upgrade a Mobile Agent?

 See the steps to upgrade iOS and Android here: Upgrade iOS SDK and Upgrade the Android Mobile Agent 

Where can I find information on how to upgrade an Agent? 

 The following documents provide the requirements and steps for upgrading an agent:

 Back to  Table of Contents


Resolving Agent Start-up Errors

How do I resolve the Analytics Agent failure to start, with a NoSuchMethod error message?

My Analytics Agent fails to start and throws the following error message. What steps should I take?

java.lang.NoSuchMethodError: io.dropwizard.logging.LoggingFactory.bootstrap


This error message is normally caused by the presence of a duplicate jar file from a different version of the Analytic Agent. This duplication can occur when the user unzips a new version of their machine-agent.zip file into the same directory where the older Machine Agent resides.

The solution is to take a backup of the old agent, either delete or rename the Machine Agent, then unzip the new machine-agent.zip

My Analytic Agent fails to start and logs show it failed to connect to the Controller endpoint

Analytics agent failed to connect to the controller registration endpoint.

This issue occurs when using a self-signed certificate for the Controller. The Analytics Agent uses a truststore for the JRE to validate the certificate of the connecting server. The truststore does not have self-signed certificates added to the store by default.

Import the client certificate to the JRE trust store, which is located in the Java directory used by the Analytics Agent by default. Example: JAVA_HOME/lib/security/cacerts  

I use the PyCharm community edition for python development sometimes, but recently when I launch it, it shows a dialog and then exits like a flash. I was confused with this for some time. And now I found how to fix it, I will share the solution in this post.

1. How To Fix PyCharm Cannot Start Steps.

  1. My OS is macOS, but the steps are similar to Windows and Linux OS.
  2. Open a macOS Finder, click the Applications item on the left side.
  3. Find the PyCharm CE icon on the right side, right-click it, and click the Show Package Contents menu item in the popup menu list. Then it will display the PyCharm CE app content in the macOS Finder window.
  4. Expand the MacOS folder in the /Applications/PyCharm CE.app folder. There is a file which name is pycharm.
  5. If you want to go to the /Applications/PyCharm CE.app folder in the terminal by command line, you should add two single quotes to the PyCharm CE.app folder like this /Applications/’PyCharm CE.app’
    $ cd /Applications/'PyCharm CE.app'
    
    $ pwd
    /Applications/PyCharm CE.app
    
  6. Or you should add a backslash before the white space in the folder path like below.
    $ cd /Applications/PyCharm CE.app
    $ pwd
    /Applications/PyCharm CE.app
    
  7. Open a terminal and drag the file /Applications/PyCharm CE.app/Contents/MacOS/pycharm from the macOS Finder window to the terminal, press Enter key on the keyboard then you will get the below output.
    $ /Applications/PyCharm CE.app/Contents/MacOS/pycharm 
    2021-03-03 18:37:06.575 pycharm[3733:100354] allVms required 1.8*,1.8+
    2021-03-03 18:37:06.583 pycharm[3733:100360] Current Directory: /Users/songzhao
    2021-03-03 18:37:06.584 pycharm[3733:100360] Value of PYCHARM_VM_OPTIONS is (null)
    2021-03-03 18:37:06.584 pycharm[3733:100360] Processing VMOptions file at /Users/songzhao/Library/Application Support/JetBrains/PyCharmCE2020.3/pycharm.vmoptions
    2021-03-03 18:37:06.585 pycharm[3733:100360] Done
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    Error opening zip file or JAR manifest missing : /Applications/PyCharm.app/Contents/bin/jetbrains-agent.jar
    Error occurred during initialization of VM
    agent library failed to init: instrument
  8. From the above output, we can see the error has occurred when processing the VMOptions file at /Users/songzhao/Library/Application Support/JetBrains/PyCharmCE2020.3/pycharm.vmoptions
  9. Open a macOS Finder window, click Go —> Go to Folder… menu item and input the folder path /Users/songzhao/Library/Application Support/JetBrains/PyCharmCE2020.3 in the popup dialog input text box, then click the Go button.
  10. Find the pycharm.vmoptions file in the above folder and move it to trash.
  11. You can also run the below command to go to the above folder in a terminal and remove the pycharm.vmoptions file.
    $ cd /Users/songzhao/Library/Application Support/JetBrains/PyCharmCE2020.3
    
    $ ls -l
    total 16
    drwxr-xr-x   3 songzhao  staff   96 Mar  3 14:35 codestyles
    drwxr-xr-x   4 songzhao  staff  128 Mar  3 14:35 eval
    drwxr-xr-x   3 songzhao  staff   96 Mar  3 14:35 event-log-whitelist
    -rw-r--r--   1 songzhao  staff   81 Mar  3 14:35 migrate.config
    drwxr-xr-x  20 songzhao  staff  640 Mar  3 14:35 options
    -rw-r--r--   1 songzhao  staff    0 Mar  3 14:34 port.lock
    -rw-r--r--   1 songzhao  staff  590 Mar  3 14:35 pycharm.vmoptions
    drwxr-xr-x   6 songzhao  staff  192 Mar  3 14:35 tasks
    drwxr-xr-x   4 songzhao  staff  128 Mar  3 14:35 workspace
    
    $ rm -rf ./pycharm.vmoptions
  12. Now you can start the PyCharm CE version successfully by clicking the PyCharm CE app icon in the Applications folder or by executing the command $ /Applications/PyCharm CE.app/Contents/MacOS/pycharm in a terminal command line.

Понравилась статья? Поделить с друзьями:
  • Error occurred during initialization of boot layer ошибка eclipse
  • Error occurred during initialization of boot layer netbeans
  • Error occurred while erasing blocks при обновлении биос
  • Error occurred while enabling is it up to date
  • Error occurred while decoding oaep padding