Where can I find com.ibm.ws.logging.object.hpel.WsLogRecord

ぃ、小莉子 提交于 2020-01-02 16:18:27

问题


One of my interns today came to me and asked where he could find the following class

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

Typically something like findjar.com would find it, but in this case it couldn't. I ended up using Jar Explorer to find it in the WAS 8 libraries within the following location, but that process was inefficient:

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

The purpose of this post is to provide insight into where it can be found, but also to ask what are the best ways to find classes when utilities online don't provide the insight you need.

Thanks, Jeremy


回答1:


I was able to find WsLogRecord under com.ibm.ws.logging.object.WsLogRecord (minus the hpel). I used eclipse to look under com.ibm.ws.logging.object and could not find hpel, but found WsLogRecord. I was able to view the actual class with jd-eclipse. Comments in the .class gave a file location (C:\IBM\SDP\runtimes\base_v7\plugins\com.ibm.ws.runtime.jar). Looks like I could not find it on findjar.com either and the .jar came as IBM's out-of-the-box code. I suppose this doesn't answer of how to find it online, but I was able to find it and then view the class with the above steps.




回答2:


What I do to find it under a running instance of WebSphere is to deploy a JSP that uses a technique described in a DeveloperWorks article to locate the jar which provided a particular class.

For posterity, here's the source of that JSP:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Servlet Container Class Finder</title>
</head>
<body>
<h2>Servlet Container Class Finder</h2>
<p>Enter the fully-qualified name of a Java class
(e.g. org.apache.oro.text.regex.Perl5Compiler) in the field below. The
servlet will attempt to load the class and, if successful, query the
class' <em>java.security.CodeSource</em> for the location of the class
using the following methods:
    <pre>
    Class.forName(className).getProtectionDomain().getCodeSource()
    </pre>
</p>
<p>
<%
    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);
            }
        }
    }
%>
</p>
<form method="post" action="<%= request.getRequestURI()%>">
    <p>
    Class Name: <input type="text" name="className" value="<%= prefill %>" size="40"/>
    <input type="submit" value="Submit"/>
    </p>
</form>
<p>
    Code taken from 
    <a href="http://www.ibm.com/developerworks/websphere/techjournal/0406_brown/0406_brown.html">
    this DeveloperWorks article</a>.
</p>
</body>
</html>



回答3:


If all else fails and I am not able to find the class using Eclipse Quick Type Hierarchy, which shows in which jar the class lives, I would use a shell script along the following lines:

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


来源:https://stackoverflow.com/questions/12007312/where-can-i-find-com-ibm-ws-logging-object-hpel-wslogrecord

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!