testdriven / psi-probe

Advanced manager and monitor for Apache Tomcat, forked from Lambda Probe
8 stars 1 forks source link

Add classpath information Tab on a webapp menu #302

Open padcom opened 10 years ago

padcom commented 10 years ago

From aziz.fa...@gmail.com on July 12, 2012 18:20:50

see attached files:

Attachment: classpath_screenshot.jpg classpath.jsp

Original issue: http://code.google.com/p/psi-probe/issues/detail?id=302

padcom commented 10 years ago

From MALfunct...@gmail.com on July 12, 2012 10:29:50

I don't know if this is even possible, but it's definitely worth investigating.

Status: Accepted

padcom commented 10 years ago

From stevenro...@gmail.com on April 02, 2013 10:04:52

One thing that may be of interest here is the jarjar library: https://code.google.com/p/jarjar Although it's primary functions is with the bundling of dependencies into one jar, it also has a few other very interesting features. Among them is a "find" command in which you give it a jar and its classpath (more correctly, you give it any two classpaths), and it locates and prints out all the resolved dependencies -- including any duplicates.

Integrating that sort of functionality into PSI isn't trivial, but checking out the inner workings of jarjar's find command would probably be a great starting point to some pretty advanced stuff.

As a quick example of how it works, say you have a webapp named MyWebApp. You'd have to rename to .war to .jar, because jarjar rejects the .war file extension (unfortunately). If jarjar.jar and the renamed MyWebApp.war.jar was found in ~, and /opt/tomcat/ was Tomcat's home, you might see output like this:

$ java -jar ~/jarjar-1.4.jar find jar ~/MyWebApp.war.jar /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/'*' ~/MyWebApp.war.jar -> /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/log4j-1.2.15.jar ~/MyWebApp.war.jar -> /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/guava-13.0.1.jar ~/MyWebApp.war.jar -> /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/jofc2-1.0-0.jar ~/MyWebApp.war.jar -> /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/joda-time-1.6.2.jar ~/MyWebApp.war.jar -> /opt/tomcat/webapps/MyWebApp/WEB-INF/lib/ojdbc6-11.2.0.1.0.jar [...etc...]