我在哪里可以找到com.ibm.ws.logging.object.hpel.WsLogRecord

我的一位实习生今天来找我,问他在哪里能找到下一堂课

com.ibm.ws.logging.object.hpel.WsLogRecord 

通常像findjar.com这样的东西会找到它,但在这种情况下它不能。 我最终使用Jar Explorer在以下位置的WAS 8库中找到它,但该过程效率低下:

 {server root}\plugins\com.ibm.hpel.logging.jar 

这篇文章的目的是提供对可以找到它的位置的深入了解,同时也可以询问当在线实用程序无法提供您需要的洞察时,找到类的最佳方法是什么。

谢谢,杰里米

我能够在com.ibm.ws.logging.object.WsLogRecord(减去hpel)下找到WsLogRecord。 我使用eclipse查看com.ibm.ws.logging.object并找不到hpel,但找到了WsLogRecord。 我能够用jd-eclipse查看实际的类。 .class中的注释给出了一个文件位置(C:\ IBM \ SDP \ runtimes \ base_v7 \ plugins \ com.ibm.ws.runtime.jar)。 看起来我在findjar.com上找不到它,而.jar也是IBM开箱即用的代码。 我想这并没有回答如何在网上找到它,但我能够找到它,然后通过上述步骤查看课程。

我在WebSphere的运行实例下找到它的方法是部署一个JSP,该JSP使用DeveloperWorks文章中描述的技术来定位提供特定类的jar。

对于后代,这是JSP的来源:

     Servlet Container Class Finder   

Servlet Container Class Finder

Enter the fully-qualified name of a Java class (eg org.apache.oro.text.regex.Perl5Compiler) in the field below. The servlet will attempt to load the class and, if successful, query the class' java.security.CodeSource for the location of the class using the following methods:

 Class.forName(className).getProtectionDomain().getCodeSource() 

<% String className = request.getParameter("className"); String prefill = ""; if (className != null) { prefill = className; if (className.trim().length() != 0) { try { java.security.ProtectionDomain pd = Class.forName(className).getProtectionDomain(); if (pd != null) { java.security.CodeSource cs = pd.getCodeSource(); if (cs != null) { out.println(cs); } else { out.println("No CodeSource found"); } } else { out.println("No ProtectionDomain found"); } } catch (Throwable t) { out.println(t); } } } %>

Class Name:

Code taken from this DeveloperWorks article.

如果所有其他方法都失败了,并且我无法使用Eclipse Quick Type Hierarchy找到该类,它显示了该类所在的jar,我会使用以下几行的shell脚本:

 for f in `find /path/to/websphere/lib -name "*.jar"` do FOUND=`jar tvf $f | grep WsLogRecord` if [[ -n $FOUND ]] then echo "Found in $f:" echo $FOUND fi done