Tuesday, September 28, 2010

Teaching Servlets with NetBeans 6.x & TomCat 6.0

I was a little embarrassed with myself when I discovered what went wrong with my NetBeans-TomCat-servlet application. My gosh! How could I have not known that?! Gosh, after years of teaching Web development.. Hehe.. It's really funny. But anyway, what matters is that I was able to realize my mistake. Handling too many subjects has left me with only an hour (mostly) to prepare for my subjects. I know it's not something to be proud of. And I'm really disappointed with myself because I wasn't able to foresee these problems when I accepted the subject load. Anyway, I just want to document this learning so I'll avoid committing the same mistake in the future.

I already installed TomCat 6.0 on my machine but I didn't start it from NetBeans. Instead, I opened my html file from where it was saved (somewhere in my local disk). Anybody who has had a background on Web development knows that you have to execute your html files from the server (ex. localhost) and not from where it is saved so that you could execute the scripts, or in this case, the servlet.

I was now confused why my html file could not "see" or locate my servlet. So I tried: removing and adding my TomCat server in NetBeans, and duplicating the servlet class in the different directories of TomCat. Nothing worked.

When I realized that I hadn't started TomCat from NetBeans, I tried to start it but now NetBeans would tell me that it failed to start TomCat because port 8080 is already in use. Argh!!! I searched the net for some answers and I learned that the error was due to multiple instances of TomCat that are running. I tried looking at the connections on my machine using netstat, and indeed, port 8080 was used. Whew!

I restarted my machine hoping that the service using 8080 would terminate. But, still I got the same freakin error! I was fed up and just tried using another port (8089) and when I started TomCat (inside NetBeans)... it worked!!! When I tried running the project, the browser was automatically invoked and the servlet did its job. Yey!!! Haha.

After all the confusion, my servlets are now running perfectly well.. :)

3rd Monthsary!

Wow. Three months have gone by and the semester is about to end next month! I really feel like I have grown so much as a teacher because of the experiences I had this semester. There were a lot of struggles, yes...but I believe I made some great achievements as well. There were major major mistakes I've made and I felt embarrassed in class (especially in Statistics), which made me hope that the earth would just swallow me alive. Haha. I really felt so dumb during those times. But well, I have forgiven myself and have gotten over it. Good thing the earth didn't swallow me at all. :D Now I have a chance to do better. Pain is really necessary for growth. As they say, "No pain, no gain.. "

This month I'm proud of myself because I de-cluttered my cubicle. Student papers are now neatly filed inside envelopes. Yey!!! :) I have 2 envelopes for each of the subjects I handle - one for the checked/recorded papers and another for unchecked papers. You'd probably think I'm weird. Hehe.. But you know, this is already a great achievement for me. I was able to organize my stuff - student papers for the first time in the n years of teaching. Haha.. My table is a little organized now.. Hooray! It helps me have a clear mind too...

Another great achievement is that I have checked almost ALL papers...thank God for the holiday (end of Ramadan) and being stressed-free, sick-free, and problem-free last weekend. Though I wasn't really able to prepare my lessons. Well..that was a tradeoff I had to risk.

I have also posted partial/final (Prelim/Midterm) grades using Google Documents. I just LOOVVEE Google! It makes my life so much better. I use Google Site to post my subject references, programming exercises, and other subject materials. I use Google Documents to save and post my grades. I also used Priority-based Inbox of Gmail to de-clutter my mails. 2 thumbs up to Google! Gosh. Do I sound like a Google fan? Haha.. I guess I am. :)

But as usual, Statistics and Trigonometry are giving me headaches. Grr.. I don't wanna dwell on that.

The sem's about to end!!! Yey!!! I'm so excited for the sembreak. I'm just not so sure if my students would be happy to receive their grades.. :( Did they learn something from me this semester???