Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening zip file or JAR manifest missing :JavaMOPAgent.jar #245

Open
MichaelMeng666 opened this issue Mar 27, 2017 · 14 comments
Open

Comments

@MichaelMeng666
Copy link

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:\workspace\test1\src\com\luo\JavaMOPAgent.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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

This is my classpath : C:\aspectj1.8\lib\aspectjrt.jar;C:\aspectj1.8\lib\aspectjtools.jar;C:\aspectj1.8\lib\aspectjweaver.jar;C:\aspectj1.8\lib\org.aspectj.matcher.jar;C:\RV-Monitor\lib\rv-monitor-rt.jar;C:\RV-Monitor\lib\rv-monitor.jar;C:\RV-Monitor\lib\aspectjweaver.jar;%RV-Monitor%\lib\logicrepository.jar; %JAVA_HOME%\lib\dt.jar; %JAVA_HOME%\lib\tools.jar;
This is part of my path:
%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;C:\aspectj1.8\bin;%RV-Monitor%\bin;D:\Program Files\TortoiseGit\bin;C:\Program Files\javamop\bin;d:\Program Files\Git\cmd;C:\apache-maven-3.3.9\bin;

@owolabileg
Copy link
Contributor

  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
Copy link
Author

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
Copy link
Author

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

@owolabileg
Copy link
Contributor

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
Copy link
Author

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
Copy link

donlaiq commented Feb 12, 2018

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
Copy link
Contributor

@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
Copy link

donlaiq commented Feb 12, 2018

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
Copy link

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

same happen to me, how did you solve this?

@MichaelMeng666
Copy link
Author

MichaelMeng666 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants