Tomcat Sysdeo

I like the Jetty maven plugin, which I’ve got another entry for. But I’m on a project that is pretty closely tied to a Tomcat installation, and the setup is pretty messy, so I don’t want to bother with figuring out how to get it to work in Jetty.

I’m using the Sysdeo Tomcat plugin for Eclipse, and so far it seems pretty good. I had to fuss with it to get to work with a maven-style project, so this is what I found.

The main thing I found was that I had to change the docbase of my servlet config to point to “src/main/webapp”. Also, I chose to use context files rather than the default of modifying servlet.xml.

  • I installed Tomcat in a neutral location, and set up server.xml with everything except the Context for my current project.

I used the right-click controls to “update context” and have the plugin install my context in Tomcat. In Eclipe’s Window/Preferences/Tomcat settings:

  • Tomcat version 6.x
  • Enter a short, all-lowercase name for the context name
  • Tomcat home is the “vanilla” installation directory of Tomcat
  • Click the “Context files” radio button
  • Verified that the context path is …/conf/Catalina/localhost under my “vanilla” Tomcat directory

I right-clicked on the project, and under the Tomcat settings, put these settings:

  • (General tab) Is a Tomcat project
  • (General tab) Can update context definition
  • (General tab) Mark this context as readable
  • (General tab) Redirect context logger to Eclipse console

(!!!!) In the context file for my project,

  • I changed the docbase to point to “…/src/main/webapp”
  • I left the work directory the same (who cares? 🙂 )

Then I can start Tomcat with the pretty button, and my application launches. It even reflects edits I make to my classes or html files, with a 1 or 2 second delay.

Not bad. There are some tricky things about the deployment of this project I’ll have to work out, but it’s nice to see it running in Tomcat without a full make/deploy/restart cycle, which was taking as long as 2 minutes for each change.

Advertisements

Leave a comment

Filed under servlets, utility

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s