runtimeverification / javamop

Runtime verification system for Java, using AspectJ for instrumentation.
http://fsl.cs.illinois.edu/javamop
MIT License
45 stars 36 forks source link

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

Open MichaelMeng666 opened 7 years ago

MichaelMeng666 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago
  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 commented 7 years ago

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 commented 7 years ago

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

owolabileg commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

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 commented 2 years ago

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

same happen to me, how did you solve this?

MichaelMeng666 commented 1 year ago

您好,您发给我的邮件已收到。