Rabu, 18 Juli 2007

Tomcat

Hi there,

I also only recently started using Tomcat and Netbeans and its a match made in heaven.
I use Tomcat for EVERYTHING.... its fantastic, wonderful, best thing I ever discovered, and
Netbeans is sizzling hot as well.

No, you dont have to use the embedded Tomcat server, and it wont be long before you get a
later Tomcat and want to use that anyway...
So what you do is open TOOLS->SERVER MANAGER and point it to the Tomcat version you want
to use... its that easy.

Now you do not have to worry about starting and stopping Tomcat(the new one) when developing,
as soon as you start a servlet it will happen automatically. If you want to stop it, you do
it from INSIDE Netbeans.... either in the Runtime Tag, or you will see you can do it from
the Tomcat Tag in the OUTPUT section of netbeans.... so you develop as normal.

Now when you CLEAN and BUILD your project you will see that it creates a DIST folder with
the WAR file... that you simply drop into the WEPAPPS folder of ANY TOMCAT.... and then start
THAT tomcat as a standalone (without netbeans running) and its deployed.... you can also use
the Tomcat manager from the web browser but I find this method easier.

Now just one thing that can be confusing.... when Netbeans does all its magic and lets your
debug stuff... it actually creates a temporary BUILD folder and when you
testing that is the code that is ACTUALLY running in the TOMCAT you using. Now what happens
alot is that you drop your WAR file into tomcat BUT its not actiully deployed because NETBEANS
still has control of Tomcat.... and what is actually happening is that Tomcat is still running
your servlet in the BUILD folder.
It doesnt pick the WAR file up. So what I do before checking a WAR in tomcat, is DELETE the
projects BUILD folder. Now if Tomcat complains, thats good, because you know it was still
looking at the devlopment environment. Just stop tomcat, put the WAR file in WEBAPPS and restart
it, it will pick up on the new WAR.

Dont give up, Netbeans and Tomcat are magic, best development environment I've ever used.


Tidak ada komentar: