Tuesday, February 19, 2008

Eclipse: Sysdeo Tomcat Launcher

I have found myself in the position to work on a lot of J2EE based web solutions as of late. While not necessarily the area that I like to work in, it is paying the bills. So to continue with my Eclipse focused articles leading up to EclipseCon, I wanted to look at the Sysdeo Apache Tomcat launcher.

I like the Eclipse J2EE tools a lot. In fact, outside of BIRT, WTP is probably one of my more used toolsets in the Eclipse environment. There are just times where it is “overkill”. Also, every now and again I run into library loading issues when launching an app in Eclipse for a web environment where Sysdeo works around that. Sometimes you don’t want a huge Eclipse environment, so a small, 3rd part plug-in fits the bill nicely, and this is where Sysdeo comes into play..

http://www.eclipsetotale.com/tomcatPlugin.html

Installation:

Extract to Eclipse Plugins folder

That’s it, your installed and ready to rock and roll. There are additional steps involved with getting the DevLoader classes installed, but I never use those.

When done, you will see a set of icons for starting, stopping, and restarting Tomcat from within Eclipse.

Now, I need to set up my Tomcat location. I go to Window/Preferences

In the dialog, I go to the Tomcat section, and choose the options to locate Tomcat and the version I am using.

Next, I go to the JVM settings option and set up the Java Virtual Machine.

Now, it is ready for use.

Usage:

In the following example, I am going to import a web project I use as a baseline. The app consists of several JSP pages, and some core libraries. I will skip the steps of importing the actual application since they don’t apply, I will just jump into the configuration of the project for Tomcat.

The first thing I want to do is right-mouse click on my project, and go to properties. Under the property dialog, I want to go to the Tomcat section, and check the option that this is a Tomcat project. I also want to set up the context I will use.

When I hit OK, a new menu will appear for my project when I right-mouse click on it in the Project Explorer. From this menu, I want to choose to add the Tomcat Libraries to my project.

I also will choose the Update context definition to add this project to Tomcat. I do hit one other snag at this point before I can actually run my project. I need to manually copy my Java libraries and compiled class files to the Tomcat folder physically. I copy all the class structures under my BIN folder to /Shared/classes and all the JAR files to /Shared/lib. That takes care of it, now I can start Tomcat and work with my app.

I typically use Sysdeo for simple web apps, JSP based solutions, or solutions with simple classes. Anything more and I will fall back to using WTP.

No comments: