<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    JBoss Source Lookup
</h3>
<span style="margin-bottom: 10px;">
    modified by <a href="https://community.jboss.org/people/snjeza">Snjezana Peco</a> in <i>JBoss Tools</i> - <a href="https://community.jboss.org/community/tools/blog/2012/01/24/jboss-source-lookup">View the full blog post</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>The JBoss Tools Source Lookup plugin automatically adds a source attachment when debugging JBoss AS servers. </p><p>The plugin has been tested with JBoss AS 7.x and JBoss AS 6.1. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h4>Installing the JBoss Source Lookup plugin</h4><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>install JBoss Tools 3.3 as described in&#160; <a class="jive-link-blog-small" href="https://community.jboss.org/community/tools/blog/2011/12/18/learn-java-ee-6-quickly-using-jboss-central">Learn Java EE 6 quickly using JBoss Central</a></li><li>call Help&gt;Install New Software..., click the Add button and enter the following update site: </li></ul><p><a class="jive-link-external-small" href="https://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/org.jboss.tools.as.sourcelookup.updatesite/">https://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/org.jboss.tools.as.sourcelookup.updatesite/</a></p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17822/lookupblog1.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17822/450-382/lookupblog1.png </span></a></p><p>Install the JBoss Tools Source Lookup category and restart Eclipse.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h4>Using the JBoss Source Lookup plugin</h4><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>set up the central JBoss Maven repository as explained in: <a class="jive-link-wiki-small" href="https://community.jboss.org/docs/DOC-15169">Maven Getting Started - Users</a></li><li>create the jboss-as-helloworld project by following the instructions in <a class="jive-link-blog-small" href="https://community.jboss.org/community/tools/blog/2011/12/18/learn-java-ee-6-quickly-using-jboss-central">Learn Java EE 6 quickly using JBoss Central</a> </li><li>wait for Maven to refresh indexes </li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The use and debugging of this plugin is demonstrated in the following screencast: <a class="jive-link-external-small" href="http://screencast.com/t/i6k9hzkjViOs">Debugging JBoss AS server</a>.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The JBoss Source Lookup plugin enhances source attachment in the following way: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>archive file doesn't have to be in the maven classpath</li><li>archive file doesn't have to be included in the classpath (jbossweb-*.jar, for instance). The JBoss Source Lookup plugin will find a class within a JBoss AS distribution and, if it is a Maven artifact, the plugin will attach the corresponding source.</li><li>archive file doesn't have to be in the m2e index (jbossjts-4.16.0.Final.jar, for instance)</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>You don't have to add any JBoss AS Runtime to the classpath. I have added it in order to ensure the classes within the runtime are included in the Java Search and in order to be easier to add a breakpoint. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><h4>Debugging Apache Tomcat and Glassfish servers</h4><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The JBoss Source plugin can serve to debug other servers.</p><p>If a server includes mavenized archives, the JBoss Source container will find, download, and show source files. <br/>I have tested the Apache Tomcat 7.0.25 and Glassfish 3.1.1. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If you want to debug Apache Tomcat and/or Glassfish, you have to do the following: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>create some Apache Tomcat/Glassfish server<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17852/lookupblog3.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17852/450-71/lookupblog3.png </span></a></p></li><li>open the server editor<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17854/lookupblog4.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17854/450-230/lookupblog4.png </span></a></p></li><li>click <strong>Open launch configuration</strong> and select the <strong>Source</strong> tab<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17855/lookupblog5.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17855/450-404/lookupblog5.png </span></a></p></li><li>click the <strong>Add</strong> button and select the <strong>JBoss AS Source Container</strong><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17857/lookupblog6.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17857/310-225/lookupblog6.png </span></a></p></li><li>JBoss AS servers will be automatically recognized and you can choose them by clicking a server <br/>As to other servers, you need to click the <strong>Choose Home</strong> button, select all the directories in which the server's archives are placed. </li></ul><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; If you debug Tomcat, you can choose $TOMCAT_HOME/lib.&#160; When debugging Glassfish, you can choose $GLASSFISH_HOME/lib and $GLASSFISH_HOME/modules. <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; You can add as many JBoss AS Source containers as you want.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17858/lookupblog7.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17858/310-295/lookupblog7.png </span></a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>move a JBoss Source container(s) to the end (optional)<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17859/lookupblog8.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17859/310-369/lookupblog8.png </span></a></p></li><li>you can add a Server Runtime container to the project's classpath (optional)<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17860/lookupblog9.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17860/254-211/lookupblog9.png </span></a></p></li><li> start the server in the debug mode<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17861/lookupblog10.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17861/450-218/lookupblog10.png </span></a></p><strong>StandardWrapper.java</strong> is placed in the glassfish's <strong>web-core.jar</strong>.&#160;&#160; <br/>The Source Lookup plugin finds this archive's source and shows it in the editor. </li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In a similar way you can debug Apache Tomcat server.</p><p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17862/lookupblog12.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17862/450-217/lookupblog12.png </span></a></p><p>The<strong> ApplicationFilterChain.java</strong> is placed in the Tomcat's <strong>catalina.jar</strong> archive. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The Source Lookup plugin finds source for a mavenized archive as follows: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li>using the m2e API</li><li>using the archive's metadata (META-INF/maven)</li><li>using nexus repositories that can be defined using the Source Lookup preferences page<p><a href="https://community.jboss.org/servlet/JiveServlet/showImage/38-4482-17863/lookupblog11.png"><span> https://community.jboss.org/servlet/JiveServlet/downloadImage/38-4482-17863/450-259/lookupblog11.png </span></a></p></li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The Source Lookup preferences page enables you to add/remove, enable/disable and/or change ordering of Nexus repositories. </p><p>You can see that the <strong>helloworld</strong> project I have used in this blog, <strong>is not a maven project</strong> (it doesn't contain the maven icon). <br/>JBoss Source Lookup plugin can be used to debug any Java project. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The plugin doesn't have to be used for debugging only. </p><p>It will find, download and open a source file for a mavenized archive included in the classpath when double-clicking a class file in the <strong>Package Explorer</strong> view, opening it using <strong>Navigate&gt;Open Type</strong> or some other way. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The JBoss Source Lookup plugin can be used for any Java project and any launch configuration. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Note</strong>: When starting debugging the first time, it could take some time until m2e updates indexes and the JBoss Source lookup plugin scans the container's directory. </p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Comment by <a href="https://community.jboss.org/community/tools/blog/2012/01/24/jboss-source-lookup">going to Community</a></p>

</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>