Manifest doesn't contain entries Main- or Premain-Class in 1.4
ttf opened this issue · 7 comments
The problem occurs with 1.4 downloaded from the maven repositories.
When trying to start with -jar
Failed to load Main-Class manifest attribute from file-leak-detector-1.4.jar
When trying to start with -javaagent
Failed to find Premain-Class manifest attribute in file-leak-detector-1.4.jar
Contents of MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: kohsuke
Build-Jdk: 1.6.0_26
I got the same error. I tried to add it as:
Premain-Class: org.kohsuke.file_leak_detector.AgentMain
But that gave:
File leak detector installed
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
Caused by: java.lang.NoClassDefFoundError: org/kohsuke/asm3/ClassVisitor
at org.kohsuke.file_leak_detector.AgentMain.premain(AgentMain.java:79)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.kohsuke.asm3.ClassVisitor
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 7 more
FATAL ERROR in native method: processing of -javaagent failed
Got it to work after the change above and including http://search.maven.org/remotecontent?filepath=org/kohsuke/asm3/3.3.0/asm3-3.3.0.jar
Looks like it is only the core library that is deployed to the Maven repository and referenced by the "Download" section for the tool.
Apply pull request 4, and run mvn package
on your clone of the Git repository in order to get target/file-leak-detector-1.5-SNAPSHOT-jar-with-dependencies.jar
Yeah, this is more of a download site problem. I was meaning to have people download jar-with-dependencies jar, but the site I link to expose plain jar.
I need to fix this.
Any word on when the fix will be available?
@dwalend I assume you found this out already. Since the jars got deployed to repo1.maven.org, you can get the 1.4 jar with the asm classes from here.
Just download the source and build it to get the jar-with-dependencies