|
If you have problems, one way to discover their nature is to start Tomcat from a Command box by entering "startup.bat" (or C:\Program Files\apache-tomcat-5.5.17\bin\startup.bat if you didn't set the Path environmental variable above). The rather friendly error messages may provide an insight into the specific problem causing Tomcat to fail to start.
Open a browser and type in a URL of http://localhost/. If everything's working you should see the Apache-Jakarta Tomcat welcome page.
If the correct page doesn't open in the browser go back through and check all of the environment variables in the Control Panel for typos and omissions. Although you are operating in a Windows environment, the Java and Tomcat directories need only be present and pointed to correctly in the environment variables in either location. There aren't any other “hidden” connectors as you might expect in standard Windows components.
Congratulations if you see the Tomcat sample page! You're halfway to a great development environment! Take some time to check the sample JSP and Servlet pages provided by Tomcat in the C:\Program Files\apache-tomcat-5.5.17\webapps\ directory. You can see the source code and the resulting web page for each example. For example, enter http://localhost/jsp-examples/num/numguess.jsp in the address bar of a browser and play their simple number game.
PATH versus CLASSPATH
If you're not confused by the distinction between the environmental variables “PATH” and “CLASSPATH” you probably don't need to be reading this tutorial.
PATH is where the operating system (XP or Vista in our case) goes to find executables (EXE's). Thus you (or sometimes the program installer) will put the “bin” directories of Java, Tomcat, and MySQL in the PATH. You should confirm the only path to a Java bin is the one pointing to the JDK you are using. The system will accept the first one and ignore any conflicting bin's that follow but you want to keep your environment variables as clean as possible. You can check the Path variable by bringing up a Command Prompt (Start Programs --> Accessories --> Command Prompt) and type in "Path". This should bring up the path variable in the command box.
CLASSPATH is where Java (the JVM) will look for jar files (i.e., compiled classes) when it's running programs. So your CLASSPATH environmental variable will have paths to two jar files for Tomcat and one for MySQL -- and probably others if you have other Java programs on your computer.
Tomcat and Vista Security
Vista with User Account Control (UAC) running causes a problem. Vista normally runs everybody -- including administrators -- in a non-administrative role. This provides additional security and makes it more difficult for intruders to run programs requiring administrative privileges. You can right click on the Tomcat desktop shortcut if you made one and chose “Run As Administrator”. Do this for both Tomcat Startup and Shutdown shortcuts. You will also need to run Eclipse in administrator mode.
For a more permanent solution, right-click on the shortcut and chose “Properties --> General --> Advanced” and check the box to run the program as administrator. Do this for both the Tomcat Startup and Shutdown shortcuts.
Tomcat overwrites an xml file when it starts up. This will fail if run on a Vista computer without administrator privileges. The command line box will show some errors but it will also finish with the Server startup message so you may get the impression you have a good Tomcat startup.
This is not a problem on XP computers.
|