facebook

Associating source for Tomcat (Catalina, etc.)

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #223330 Reply

    How does one associate source for the internals of Tomcat 5, so I can step into the Tomcat code (Catalina, etc.) I have the source downloaded and when I’m in the debugger, I can right click on a Tomcat call in the stack trace, open the Tomcat5 launch configuration and add source directories, but when I exit (and save the configuration), Eclipse still does not show source. When I open the launch config again, my source attachments have disappeared. I do not see any way to get to the launch configuration from the MyEclipse preferences.

    #223335 Reply

    Riyad Kalla
    Member

    This is just a matter of downloading the Tomcat 5 source and attaching it to a JAR in your classpath. Try and find out which JAR contains the code you want to step into, add it and then attach the respective source to it.

    #223355 Reply

    The problem is, I don’t have direct access to the Tomcat jars from MyEclipse in order to attach the source. I have just a MyEclipse web project; my project’s build path does not contain any Tomcat jars – ony the “J2EE 1.4 Library Container” library and the “JRE System Library”, and my WEB-INF/lib jars. The debugger does not reference any jars either.

    WHat I did was create a separate User Library which I called Tomcat5 and added all the Tomcat jars to it. I then set source associations for all of the jars. In order to support debugging, I added this library to my build path for my web application,
    but this is really not the correct action, because I don’t want all those jars on my build path (it will confuse things like code completion and Organize Imports etc. That is, it will be too easy to accidentally inject a Tomcat class into my web application, rendering it non-portable).

    Anyway, if anyone else needs to do something similar, below is an Eclipse user liberary which I exported from Eclipse 3.0.1
    which I was able to use for debugging som Tomcat 5 Jasper code that was throwing an exception. Use at your own risk;
    I suggest disabling this library when you don’t need to debug into Tomcat code. It’s not 100% complete – I attached source
    to the more important jars, but not all of them, and of course you will need to change my jar and source path. Save the XML
    below and define a new User Library (Preferences->Java Build Path) and import the xml.

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <eclipse-userlibraries version=”1″>
    <library name=”Tomcat5″ systemlibrary=”false”>
    <archive javadoc=”http://java.na.sas.com/reference/api/other/j2ee/1.3.1/doc/api/&#8221; path=”C:\Java\tomcat5\common\lib\servlet-api.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\commons-collections-3.1.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\commons-dbcp-1.2.1.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\commons-el.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\commons-pool-1.2.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\jasper-compiler.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-jasper\jasper2\src\share”/>
    <archive path=”C:\Java\tomcat5\common\lib\jasper-runtime.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-jasper\jasper2\src\share”/>
    <archive javadoc=”http://java.na.sas.com/reference/api/other/j2ee/1.3.1/doc/api/&#8221; path=”C:\Java\tomcat5\common\lib\jsp-api.jar”/>
    <archive path=”C:\Java\tomcat5\common\lib\naming-common.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\common\lib\naming-factory.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\common\lib\naming-java.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\common\lib\naming-resources.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-util.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\util\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-ant.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-cluster.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-i18n-es.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-i18n-fr.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-i18n-ja.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\catalina-optional.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\commons-beanutils.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\commons-digester.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\commons-fileupload-1.0.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\commons-modeler.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\jakarta-regexp-1.3.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\jkconfig.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\jk\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\jkshm.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\servlets-common.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\servlets-default.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\servlets-invoker.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-catalina\catalina\src\share”/>
    <archive path=”C:\Java\tomcat5\server\lib\servlets-webdav.jar”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-coyote.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\coyote\src\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-http11.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\http11\src\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-jk2.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\jk\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-jk.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\jk\java”/>
    <archive path=”C:\Java\tomcat5\server\lib\tomcat-jni.jar” source=”c:\Java\tomcat5\src\jakarta-tomcat-connectors\jk\java\”/>
    </library>
    </eclipse-userlibraries>

    #223358 Reply

    Scott Anderson
    Participant

    The Tomcat-specific jars are not in the workspace since they’re not needed for compile-time checking of the source. However, if you create a new java project and load the source into it, the Eclipse debugger should be able to find it, particularly if you add it as a dependent project to your web project. If you do that, however, remember to adjust your project-specific deployment options so that all the tomcat classes are not deployed with your web application. More information on that can be found in the Advanced section of our Working with Web Projects Quickstart in the Documentation section here: http://www.myeclipseide.com/ContentExpress-display-ceid-67.html

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Associating source for Tomcat (Catalina, etc.)

You must be logged in to post in the forum log in