MyEclipse Forums
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
support-rkalla
Post subject: [Tomcat] How do you debug Tomcat sources?  PostPosted: Oct 05, 2006 - 03:29 PM
Registered Member
Registered Member


Joined: Jan 06, 2004
Posts: 23818

This question is meant to help people that, while debugging, may want to actually step into the Tomcat source files like the Catalina request processors or something along those lines. Long time MyEclipse guru arjan.tijms has posted very detailed steps on how to get this working and they are as follows:

* Download tomcat sources and extract

* The actual source is spread throughout many different directories, collect them all into a single directory (you'll end up with a javax.servlet.* and a org.apache.* if you do this often you may wish to create a script for doing this)

* Create a new webproject and copy the merged tomcat sources to it
You'll notice a lot of unmet dependencies. This doesn't matter as JDT is still able to do its work. If you wish you can satisfy these depencies by copying libs like commons-collections, commons-logigng etc to this project's path.

* JAR both the sources and compiled classes. In my project I have an ant file in a directory tomcat5.5.17/build_libs, where tomcat5.5.17 is the name of my project. E.g.
Code:

<project name="tomcat" default="doTomcat" basedir="../." >
   
 
  <property name="buildDir"             value="build_libs"                />
  <property name="binSourceDir"          value="WebRoot/WEB-INF/classes/"   />
  <property name="srcSourceDir"          value="src/"                  />
   
  <target name="doTomcat" >
     <jar destfile="${buildDir}/tomcat_5_5_17.jar"  basedir="${binSourceDir}"
        includes="javax/servlet/** org/apache/**"
     >   
     
   </jar>
   
   <jar destfile="${buildDir}/tomcat_5_5_17_src.jar"  basedir="${srcSourceDir}"
        includes="javax/servlet/** org/apache/**"
     >   
   </jar>
       
     <eclipse.refreshLocal resource="tomcat5.5.17/${buildDir}" depth="infinite"/>
             
  </target>
 
</project>

* In the project where you wish to step into tomcat's source code, create a directory -outside- of your web root, e.g. [project root]/ext_src (it must be created outside the web root so it doesn't get deployed).

* Copy the tomcat_5_5_17.jar and tomcat_5_5_17_src.jar to this new directory.

* In your project settings, add ext_src/tomcat_5_5_17.jar to your Java build path.

* While the Java build path dialog is still open, unfold the jar you just added and do a source attachment to the tomcat_5_5_17_src.jar.

* You may wish to close the other project where you generated the jars.

You can now step into the majority of the tomcat source code from your own code. For a few classes the MyEclipse J2EE 1.4 library container still takes precedence when debugging, notably javax.servlet.jar. Sometimes it helps to attach the tomcat_5_5_17_src.jar to this.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits