| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>6.5 Class Loading Command Reference</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo User Guide"><link rel="up" href="ch06.html" title="6. Equinox Console"><link rel="prev" href="ch06s04.html" title="6.4 Class Loading Commands"><link rel="next" href="ch07.html" title="7. The Web Admin Console"><!--Begin Google Analytics code--><script type="text/javascript"> |
| var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); |
| document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| </script><script type="text/javascript"> |
| var pageTracker = _gat._getTracker("UA-2728886-3"); |
| pageTracker._setDomainName("none"); |
| pageTracker._setAllowLinker(true); |
| pageTracker._trackPageview(); |
| </script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6.5 Class Loading Command Reference</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06s04.html">Prev</a> </td><th width="60%" align="center">6. Equinox Console</th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="admin-shell-class-loading-reference"></a>6.5 Class Loading Command Reference</h2></div></div></div><p>This section contains reference information about the class loading commands |
| <a class="link" href="ch06s05.html#admin-shell-cl-clhas" title="clhas command">clhas</a>, |
| <a class="link" href="ch06s05.html#admin-shell-cl-clexport" title="clexport command">clexport</a>, and |
| <a class="link" href="ch06s05.html#admin-shell-cl-clload" title="clload command">clload</a>. |
| </p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="admin-shell-cl-clhas"></a>clhas command</h3></div></div></div><p>Use the <code class="literal">clhas</code> command to list the classes contained in the bundles deployed to VTS and to solve class loading issues.</p><p>The command accepts as a parameter the fully qualified class name (in the form <span class="emphasis"><em>package.class</em></span>).</p><p>A bundle is listed only if the class can be loaded. If the class is successfully loaded a check is made if the loading was delegated to another bundle. The command lists only the leaves in the class loading hierarchy - i.e. the bundles that actually contain the class and not the ones that delegate to another bundle via import/require mechanisms.</p><p>The following examples show how to use this command.</p><p>Use the <code class="literal">clhas</code> to view all bundles that contain <code class="literal">Servlet</code> class:</p><pre class="programlisting">osgi> clhas javax.servlet.Servlet |
| |
| Bundles containing [javax.servlet.Servlet]: |
| 14 com.springsource.javax.servlet</pre><p>The following example shows how to identify a possible <code class="literal">ClassCastException</code> due to wrong packaging:</p><pre class="programlisting">osgi> clhas javax.servlet.Servlet |
| |
| Bundles containing [javax.servlet.Servlet]: |
| 66 myapp |
| 14 com.springsource.javax.servlet</pre><p>It's obvious that the <code class="literal">javax.servlet</code> package should not be present in <code class="literal">myapp</code> application and its packaging has to be changed. This problem can often be seen in WAR or web bundles that package Servlet/JSP classes by accident.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="admin-shell-cl-clexport"></a>clexport command</h3></div></div></div><p>Use the <code class="literal">clexport</code> command to list the bundles that export a class or package.</p><p>The command accepts as a parameter the fully qualified class name (in the form <span class="emphasis"><em>package.class</em></span>).</p><p>The command checks to see if the provided class is actually contained in a bundle. If the class is not found in a bundle, but its package is exported then a hint <code class="literal">[class not found, package only]</code> is displayed.</p><p>The following examples show how to use this command.</p><p>Use the <code class="literal">clexport</code> to view all bundles that contain <code class="literal">Servlet</code> class:</p><pre class="programlisting">osgi> clexport javax.servlet.Servlet |
| |
| Bundles exporting [javax.servlet.Servlet]: |
| 14 com.springsource.javax.servlet</pre><p>If a bundle exports a package but the requested class is not contained the output of the command will be similar to this:</p><pre class="programlisting">osgi> clexport javax.servlet.ServletX |
| |
| Bundles exporting [javax.servlet.ServletX]: |
| 14 com.springsource.javax.servlet [class not found, package only]</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="admin-shell-cl-clload"></a>clload command</h3></div></div></div><p>Use the <code class="literal">clload</code> command to list the bundles that can load a class or to check if a specific bundle can load a class.</p><p>The command accepts as a parameter either: |
| </p><div class="itemizedlist"><ul type="disc"><li><p>the fully qualified class name (in the form <span class="emphasis"><em>package.class</em></span>)</p></li><li><p>the fully qualified class name (in the form <span class="emphasis"><em>package.class</em></span>) and the symbolic name or id of the bundle that is to be tested</p></li></ul></div><p> |
| </p><p>The command lists not only the bundle that successfully loaded the class, but also the one that actually provides the class. This is visualized with hints like <code class="literal">[exported by 14 com.springsource.javax.servlet]</code>.</p><p>The following examples show how to use this command.</p><p>You can use the <code class="literal">clload</code> to view all bundles that can load <code class="literal">Servlet</code> class:</p><pre class="programlisting">osgi> clload javax.servlet.Servlet |
| |
| Successfully loaded [javax.servlet.Servlet] from: |
| 56 com.springsource.org.apache.taglibs.standard |
| [exported by 14 com.springsource.javax.servlet] |
| 54 org.eclipse.virgo.apps.admin.web |
| [exported by 14 com.springsource.javax.servlet] |
| 19 com.springsource.org.apache.commons.fileupload |
| [exported by 14 com.springsource.javax.servlet] |
| <... remainder omitted ...></pre><p>If a bundle is to be tested, then its id can be used as a command parameter:</p><pre class="programlisting">osgi> clload javax.servlet.Servlet 19 |
| |
| Successfully loaded [javax.servlet.Servlet] using class loader from: |
| 19 com.springsource.org.apache.commons.fileupload |
| [exported by 14 com.springsource.javax.servlet]</pre><p>Or the same class load test can specify the symbolic name of the bundle:</p><pre class="programlisting">osgi> clload javax.servlet.Servlet com.springsource.org.apache.commons.fileupload |
| |
| Successfully loaded [javax.servlet.Servlet] using class loader from: |
| 19 com.springsource.org.apache.commons.fileupload |
| [exported by 14 com.springsource.javax.servlet]</pre></div></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript"> |
| _lf_cid = "LF_48be82fa"; |
| _lf_remora(); |
| </script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06s04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.4 Class Loading Commands </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 7. The Web Admin Console</td></tr></table></div></body></html> |