jenkinsci / lib-file-leak-detector

Java agent that detects file handle leak
http://file-leak-detector.kohsuke.org/
MIT License
241 stars 112 forks source link

Manifest doesn't contain entries Main- or Premain-Class in 1.4 #3

Closed ttf closed 10 years ago

ttf commented 12 years ago

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

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

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

jesperpedersen commented 12 years ago

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

kohsuke commented 12 years ago

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.

dwalend commented 11 years ago

Any word on when the fix will be available?

fakraemer commented 11 years ago

@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.

mcacker commented 11 years ago

Just download the source and build it to get the jar-with-dependencies