kyrill007 / loosejar

Automatically exported from code.google.com/p/loosejar
Apache License 2.0
23 stars 16 forks source link

Getting InvocationTargetException #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running Tomcat 6 via jsvc
2. Java ver 6
3. Linux (OpenSuse 10)
4. Using LooseJar 1.0.0

When I invoked the "summary()" operation in JConsole, an "Error" window opens 
in JConsole with the following message:

********************************************************
Problem invoking summary : java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
********************************************************

In addition, I get the following output in "catalina.out":

---------------------------------------------------------
[loosejar]: Found 42279 classes loaded in the JVM.
[loosejar]: Found 1107 various ClassLoader(s) inside the JVM.
[loosejar]: Failed to invoke #findResources(String) method on classloader 
[WebappClassLoader
  delegate: false
  repositories:
].
---------------------------------------------------------

Interestingly enough, I can get loosejar to work on a similarily configured 
machine... there must be some subtle difference between the two machines that I 
am not aware of. Could this be some kind of permissions issue?

Original issue reported on code.google.com by wayne.we...@gmail.com on 17 Sep 2010 at 6:20

GoogleCodeExporter commented 9 years ago
On Tomcat?

Original comment by kyrill...@gmail.com on 17 Sep 2010 at 7:28

GoogleCodeExporter commented 9 years ago
Yes, the "catalina.out" is from Tomcat's log file. I can't exactly understand 
why it works on one OpenSuse linux machine and not on another. It may have 
something to do with starting Tomcat with "jsvc" but I am using the same "jsvc" 
compilation on both machines. And in both cases, "jsvc" runs Tomcat as a 
non-root user.

A bit of a mystery why loosejar failed to invoke the "findResources" method on 
the classloader.

Original comment by wayne.we...@gmail.com on 17 Sep 2010 at 8:47

GoogleCodeExporter commented 9 years ago
I think I may know the cause of this problem. It appears this problem happens 
if an application fails to start up or if an application is manually stopped 
through the mananger. Even if I manually stopped and started the application, 
the problem would still happen. After stopping and restarting an application 
via the Tomcat mananger,  I had to restart Tomcat in order to get loosejar to 
work.

Loosejar is really a great application! Thanks for your contribution.

Original comment by wayne.we...@gmail.com on 20 Sep 2010 at 4:36

GoogleCodeExporter commented 9 years ago
I've confirmed that the problem is Tomcat starting up with an application that 
failed to start: an exception at startup prevented the application from 
starting. Under this circumstance loosejar will generate the error as described 
in the beginning of this thread.

Original comment by wayne.we...@gmail.com on 20 Sep 2010 at 9:36

GoogleCodeExporter commented 9 years ago
So, basically loosejar fails to invoke "findResources(String)" on a classloader 
from a stopped application... I wonder if I should guard against such errors 
with a simple try/catch... Interesting...

Original comment by kyrill...@gmail.com on 21 Sep 2010 at 12:41

GoogleCodeExporter commented 9 years ago
I've patched it up and uploaded 1.0.1 version. This should take care of it. Let 
me know how it goes.

Original comment by kyrill...@gmail.com on 21 Sep 2010 at 12:48

GoogleCodeExporter commented 9 years ago
YES! IT WORKS! Thanks a lot, I really appreciate it. 

I also wrote a quick little program which crunches the outputs from loosejar 
and finds all those jars that are unused and I attached it here, in case anyone 
doesn't feel like writing it.

Original comment by wayne.we...@gmail.com on 21 Sep 2010 at 8:40

Attachments: