Debugging Tomcat Using JDB

As a fan of Vim and console development and a staunchent opponent of IDEs (not that they don’t have their merrits, they are simply too complicated and too prone to breaking when some miniscule setting is changed IMO), I attempted to figure out how to debug Tomcat using the command line java debugger yesterday. To do so, you will need todo a few things; mainly enable debugging support in the server, locate the source code corresponding to the servlet you will be debugging, and familiarize yourself with the JDB tool.

By default if you run the tomcat startup script with parameters “jpda start” the server will automatically be placed in debugging mode. There are a few caveats to this, and you can configure the behavior of this by opening up and looking at the config options described at the beginning of the file. Whatever you decide to change will need to exported before the script is run, so for example to change the default behavior to force the server to wait until a debugger is attached and the “run” command is invoked (before it tries to load any servled) you would issue a


You may desire to change some of the other default values, for example the default debugging port Tomcat uses (8000) as it may be employed by some other service (in Fedora 7, the network audio server (nas) is enabled by default and uses that port)

Next you will need to have access to the source code backing the servlet you are debugging. Unfortunately jdb cannot read source out of a jar so you will need to uncompress any source directories that you may have and specify their location to jdb via the command line (though now irrelevant, I discovered yesterday maven can create a source-jar with the “maven-source-plugin” plugin). To start debugging, simply issue the following command:

  "jdb -attach 8000 -sourcepath dir1:dir2:dir3"

(obviously changing the port and colon seperated source directory list). If the sourcepath isn’t specified, the default will be ‘.’. Furthermore, since java uses the full package/class name to refer to classes, which ties into the paths which they are located, you will need the entire correct directory structure setup correctly under the sourcedir(s) (eg. if you want to debug com.foobar.Class you will need com/foobar/ under one of the sourcedirs specified

You should now be in debugging mode (recall that if the Tomcat suspend option is set, you will have to issue ‘run’ before the server execution continues). Though I do not have the space to detail everything here, I will list some of the more useful commands that I’ve found:

If everything went as expected you should now be able to debug any servlet running in Tomcat. Pretty simple huh? While JDB isn’t the most user friendly debugger, it is very simple and intuitive, a value which I hold dearly.

Fedora 7 On VmWare Server 1.0.4

(The Dell Latitude Fedora 7 install guide is coming in the near future, I promise)

I’m in the midst of a major infrastructure overhaul, driven by my desire to have simple/robust/always availible hosts. I’m virtualizing all my development environments so that I can hose them at will. The VMWare workstation license that I got from school expired, so I downloaded and installed the free VMWare Server.

Unfortunately there is a problem with the linux ata_piix driver with the latest VMWare Server 1.0.4. Whenever I create the virtual machine and goto install Fedora 7 from the DVD, the anaconda starts up, but hangs indefinately on

"Loading SCSI Driver  Loading ata_piix". 

Pressing Alt-F4 to open the terminal reveals that it is probing all the possible SCSI devices from SDA to SDZZ (presumably) and since each missing device takes 45 seconds to time out, this is unacceptable. The solution (found here) is to open the vmx file in the virtual machine directory and add the following line:

'scsi0.virtualDev = "lsilogic"'

And then proceed with the installation. You will get a message saying the virtual device was configured for bug logic, prompting you to switch it to lsilogic. Simply click yes (the warning about installed machines not working can be ignored as you haven’t installed anything yet) and installation should occur flawlessly.

Stay tuned as my complete infrastructure overhall overview is coming with instruction on competing the more difficult tasks

Installing Fedora Core 6 -- Zod -- on the Acer Aspire 5102WLMI Notebook

(Standard Disclamer: I am not responsible for any changes you do to your system and their results/outcomes, follow this guide at your own risk!)

Overview: Slackware is a great distro. But in reality it is a hobbyists distro, and I find it lacking in some respects to make it an established, widely-supported Linux distribution (smaller community, no default dependency resolving, etc.) Fedora has always been my distro of choice since I’ve started using it (I’ve tried Ubuntu, Debian, and Slackware in the meantime) and decided to give it another go. Previously I tried installing Fedora 5 on my laptop, but after the complete install, the system would freeze on launching udev (very early in the boot process). I downloaded the Fedora Core 6 (Zod) live cd recently, and am happy to say that the entire system booted flawlesly, with all most all of the hardware fully functioning. After downloading (same site) and burning the Fedora Core 6 (Zod) x86_64 Installation DVD (and realizing after two long failed attempts that the first dvd I burned had a large scratch in it :-/) I succesfully installed and booted into Fedora Core 6. The following details the exact process I used to make the system fully functional.

General Hardware Specifications:

Hardware ComponentsStatus Under LinuxNotes
AMD Turion 64x2 (64-bit, dual core) CPUWorksNo special setup needed. Make sure you download the x86_64 dvd/cd’s
512MB DDR2 RAMWorksNo special setup needed
100GB PATA Hard DriveWorksNo special setup needed
TouchpadWorksNo special setup needed
Speakers/Headphone JackWorksSmall tweak needed, see step 12
ATI Radeon Xpress 1100WorksEnable Livna; Install Driver; Modify xorg.conf; See Step 11
Realtek Ethernet network cardWorksNo special setup needed
Atheros Wifi Network CardWorksEnable Livna; yum install madwifi; Select the right Kernel on Boot; See Step 10
CD/DVD Reader/BurnerStill Testing
USB PortNo special setup needed
Card ReaderStill Testing

Steps I performed to get Fedora Core 6 –Zod– Working: 1. I had previously repartitioned the default hard drive layout to install Slackware, reinstalled Windows XP, and made a Windows Backup Disk. Please do this. It never hurts to be safe. See this for more information. All in all my hard drive layout looks like: * /dev/hda1 20GB vfat for Windows XP * /dev/hda2 20GB ext3 for Slackware * /dev/hda3 1GB swap (yea this is probably alot bigger than I need but w/e) * /dev/hda4 55GB vfat for shared documents and data

  1. Toss the Fedora DVD in. I recommend letting the installer verify the DVD. It only takes 20 minutes, and would have saved me 2-3 hours as my original DVD had a scratch and was corrupted.

  2. I selected the default language and keyboard (english for both).

  3. At the Hard Drive Partitioning screen, I opted to create a custom layout from the pull down menu and clicked next. On the following screen, I selected partitions 1,2,4 clicked the “edit” button, and changed the following settings:

  4. /dev/hda1 - mounted at /mnt/winxp

  5. /dev/hda2 - mounted at / and formatted to ext3 (getting rid of slack)

  6. /dev/hda4 - mounted at /mnt/shared Clicking next will prompt you to verify that you want to format /dev/hda2. Click yes.

  7. I left the GRUB settings with their default values (will install GRUB over the mbr), but changed the name of the “other” operating system to “Windows XP”

  8. Plug a ethernet cable from your router/switch/wall outlet into your laptop and leave the default settings as is on the Network Devices screen. Wifi doesn’t work out of the box, and we will need to get it working later (see below).

  9. Select your timezone and root password on the next few screens. On the next screen select the appropriate software categories for you and enable Fedora Extras (internet connection required). I did not opt to customize my software now, I will use yum to install everything from the repo’s. Click next (and next again after a minute) and wait (about 45 min) for all the software to install (if it freezes here, like it did for me, your installation DVD/cd is corrupted and you need to reburn. I told you to test it! :-/)

  10. Its installed! Take out the DVD and hit restart when prompted. The next few config screens as self explanitory. The only major change I made was to disable SeLinux completely (I have no use for it), which required a restart. Upon the next boot you will be able to login!

Note: Make sure Windows XP boots as well. If you followed my instructions, I’m sure it will. Note: Make sure to boot with your ethernet cable plugged in. The process will stall at starting xend until you have an internet connection. I am not yet sure if it is safe to disable the virtualization daemon. Note: You might also want to disable the yum-updatesd service (eg. run “service yum-updatesd stop”). The version that comes with Fedora 6 eats up memory (not sure if its a leak or if it just does that), consuming 20% of my 512MB of memory (resulting in lots of paging and poor disk performance).

  1. Upon booting up, I immediately installed the yum fastest mirror plugin (written by my fellow RedHat intern Luke), by running “yum install yum-fastestmirror”. After that was done, I ran “yum update -y” to update all the packages in the system to their latest version. This process will take a little while, so you might want to start it before you goto sleep (make sure you have a cooling pad or fan blowing on your computer as this laptop tends to get hot), or when you have a several hours to spare.

  2. Restart you computer for good measure and enable the livna yum repository. This is a very simple procedure, and has all the info you need. Afterwards, run the following command to install the atheros wifi driver “yum install madwifi”. The madwifi driver depends on a non-xen kernel (probably nothing in the xen kernel preventing atheros from working, but it prob is not configured) which it will download. Virtualization with Xen is not an issue for me (I will use Vmware to boot into windows while running linux, blog about it coming soon), so I set the new one to be default in my /boot/grub/menu.lst before rebooting. I also enabled the NetworkManager service (System Menu > Admin > Services > Check “Newtork Manager” and Save) to handle my network connections and disabled wifi from being initialized on bootup, before I can enter the WPA key or my gnome keyring password (System Menu > Admin > Network > Select “wifi0” > click “edit” > uncheck “activate at boot” > save). Restart and you can access wifi as soon as you login and connect to a network!

  3. Install the proprietary ati graphics driver by running: “yum install xorg-x11-drv-fglrx”. Since Fedora ships with Compiz by default, you will need to modify your /etc/X11/xorg.conf file (as root) by changing the following: *In the Section “Module” add Load “glx” Load “dri” *In the Section “Extensions” add Option “Composite” “Disable”

After saving you will need to log out / kill X with ctrl-alt-backspace, and log in again. Of course this will mean you can’t use compiz/beryl, but you can play around with them by commenting out the Disable Composite line. I have yet to get Compiz (shipped with Fedora by default) working, possibly because there are issues with some ATI cards/chips. One annoying thing that I notice is that unless Composite is enabled, eg. fglrx disabled, whenever I minimize a window or use alt-tab to select another, the currently selected window goes black. I believe that this is some buggy compiz feature that isn’t disabled when compiz is. Its annoying, but I can live with it for now.

  1. Audio was working fine and dandy until it seemingly randomly messed up. One day all audio that was played only came out of one speaker. I have no idea what caused this, but after a bit of googling around, I found this great post which solved my problem. So I thought. After adding the following to the “option snd-hda-intel index=0” line to /etc/modprobe.conf (append this text to the same line): “model=3stack positionfix=0 singlecmd=0”, and restarting, it worked… until I restarted again. I removed the line and discovered that both speakers would work if I used the volume applet to slide the volume to 0 then back to where I wanted it, both speakers worked perfectly. Very wierd, and I’ll look into it further at another time.

4 months...

and no update (shows you how much I’m into blogging :-p). In addition I’m only adding this blurb because I’m about to add a new howto detailing instructions on installing Fedora 7 on the Dell Latitude D830.

But in any case, all in well in the life of Mohammed Morsi, I finished up my internship in New York City (I hope to be back soon, as it is truly an amazing city) and am working full time for Red Hat (the company I interned for (twice)). I’m in Raleigh, NC temporarily (where my company’s headquarters is located) so I can work on site with my team, but come early November I can essentially work out of whereever I want. I’m going back to Syracuse (hopefully for only a few months) so that I can finish my masters thesis and get my graduate degree. After that as mentioned I may move back to New York city, out to California to visit my good friend Dave Rappaport, to Boston where my company’s main technical office is located (alot of Kernel and Gnome engineers work out of that one), or perhaps to one of the many international offices Red Hat has around the world (I like to travel, and I love that I have the choice).

As for my actual job, I am working on the backend to RHX ( and on various other tasks my company is having me do. I’m not sure how much I can talk about the actual code I’m writing, but it is very easy/straight forward for the most part and I was able to pick it up and start being productive from week one. I do have a sweet new laptop (the Dell Latitude mentioned before) and will post my full review and installation guide by the end of the day (hopefully :-/). Take it easy!

Tunneling SSH

(I’m in NYC working for Red Hat right now and am insanely busy. I’m having a great time and will describe everything in my blog in the near future).

Finally figured out ssh tunneling.

  1. Run your own ssh server (lets call it
  2. On the client side, run ssh -N -D 8000 -N means dont run a program, eg. bash -D is the local port ssh will listen on

  3. Configure Firefox SOCKS PROXY (not a HTTP PROXY) to point to localhost:8000. Make sure its using Socks4 and you are not setting the http or other proxy fields (took me a while to figure that one out). Since this setting is far into the options settings, download an extension ( to add a button or toolbar to control it.

Once everything is setup, all your web traffic should be tunneled over ssh. Modify the proxy settings for other programs as necessary.

A much needed update

Since its been nearly two months since my last post, I believe an update is long overdue. Apologies to my non-existant blog readers, as I have been insanely busy with school and haven’t had time for much else. But the semester finally finished and the fun is just beginning!!!

I suppose the biggest news I have is that I interviewed for and was offered/accepted another internship position at Red Hat. Even better, the position is in New York City (not that Raleigh was bad, but NYC is closer to Syracuse and much bigger). I’m not sure of the exact details of what I am going to be doing, but I am excited neverless. I’m head down there the weekend after next, staying at Columbia University (right in the middle of midtown), and start working on the 21st.

As I mentioned before, I finally finished the three courses I was taking this semester, including Computer Security, Object Oriented Design, and Distributed Objects. I have updated the projects page to include select highlights of my work this semester. I am planning on taking Internet Programming this summer. Since it is a project based course (submitted online with no tests) and I have a ton of experience with web development (not ASP.NET unfortunately, which the class is in) I am not that worried. But to make things even more interesting I want to get a ton of work on my Master’s Thesis done this summer. I have nailed down an idea and an advisor, and am currently in the process of writing an abstract. Needless to say its gonna be one busy summer (bring it on, I say)

Just to wrap up a few things mentioned previously. I bought a new cell phone, and had Verizon transfer my number (found the old one when the snow melted, but needless to say it was broke). My friend Jack is going to be ok, he got in touch with a specialist, and since the situation was still early, he got much better. Lastly, I’m still working on the Squirellmail/Drupal extensions I had previously mentioned, and ideally they will be ready by the end of the month, but no promises :-p

Anyways, as the rigerous project deadlines are a thing of the past (until next semester), I will be updating this more often, so make sure to check back!

Know Anything About Fluoride Poisoning?

I recently found out that a good friend of mine Jack Aboutboul has recently started suffering from a condition known as Fluoride Poisoning. Details are scarce, but the condition is serious, and he is in the process of gathering information and figuring out his options. He is asking that anyone who knows a bit about this condition, treatment options, contact him. If you know anything that might be helpful, please contact him at jaa at redhat dot com or me at movitto at yahoo dot com (I will forward all info immediately). Any help is greatly appreciated.

edit: It seems like Jack found a source of the information that he was looking for, and the situation is now under control. Definitely dodged a bullet on that one. Best of luck Jack!

Projects I Have Worked On

Alright, enough about what I’ve configured and installed (and how I did it), and onto the fun stuff; namely programming! I’ve uploaded several of my favorite projects, which I have worked on in my academic and professional careers as well as on my spare time, to my projects page. Here you will be able to see some of the work I am most proud of such as the compiler for my simple language called PL, my senior level engineering project, and my IPSec implementation for Minix.

I am also currently working on an extension to the SquirrelMail webmail client (I’m not telling what it will do yet ;-p) when I have the spare time (which is not often these days). The plugin API is similar to that of Drupal, which I have written modules for in the past (see my projects page), involving hooks and such, and thus it shouldn’t take me too long to finish. Once complete, I will upload the code/documentation to my projects page as well as to the official squirrelmail site, and begin working on my next idea (once again, not telling what it is yet :-D)

Cool Wall Touch Screen

As we incorporate technology more and more into our lives, the more we will demand it to adapt to our natural patterns and actions. As time progresses interfaces will need to evolve to be more fluid in interaction. The following video caught my eye the other day:

Running Windows On Fedora Linux Using VMWare

Due to the fact that Syracuse University is very Microsoft-centric, I find myself needing to boot into my Windows partition often to do some work. Because I use VMWare to run multiple instances of Linux and Minix, I decided to give it a whirl and try to get Windows Media Center Edition running virtually. I found this great tutorial the other day which offered me most everything I needed. (mirrored here with bad formatting) The following is a list of the small derivations I had to do, to get it fully working:

And Thats It, Best Of Luck!!!!