Stunnix Advanced Web Server - preparing Tomcat sites
Introduction
You have to be able to start Tomcat shipped with SAWS correctly without SAWS first, and only then try to port it to SAWS.
- Ensure that server.xml and context.xml exist in extensions/engines-noarch-standard/tomcat.5.5.26/conf/ If they are not there, run SAWS demo with Tomcat from HDD, stop SAWS demo, then copy those files from a directory with SAWS demo to directory with your prototype's output directory.
- change direcory to extensions/engines-noarch-standard/tomcat.5.5.26/bin/ (related to your prototype output directory)
- create file named sawsdbg.bat there and paste the following content into it:
set JRE_HOME=..\..\..\engines\java.jre1.4.2_03-x86-windows catalina.bat run
If you are using some other version of JRE, update 1st line accordingly. - Run that file by double-clicking. It should start Tomcat. Several seconds later
you should see something like this on the 10th line from the bottom:
INFO: Starting Coyote HTTP/1.1 on http-9003
This means 9003 is the port Tomcat is accepting http connections. This means you can access it using url http://127.0.0.1:9003.If you've configured your Tomcat correctly, your should be able to work with your webapp in browser.
If something goes wrong
If your webapp does not work properly, go to Task Manager (ctrl-alt-del on WIndows), select java.exe in the list of processes and terminate it.
To view Tomcat's diagnostics that is printed during Tomcat startup, we will have to capture error log to some file. To do this, go to direcory to extensions/engines-noarch-standard/tomcat.5.5.26/bin/ (related to your prototype output directory) and create file named sawsdbg-log.bat there and paste the following content into it:
set JRE_HOME=..\..\..\engines\java.jre1.4.2_03-x86-windows catalina.bat run >log.txt 2>&1Once you'll click that file, a console window will open, but no trace from tomcat will appear. All trace information will go to file named "log.txt" in the directory where that sawsdbg-log.bat resides (../tomcat.5.5.26/bin/).
You can double-click on log.txt to see all Tomcat's error messages.
To terminate Tomcat, press Ctrl-C 3 times in that console window.
Common mistakes
- Make sure your .xml files inside extensions\engines-noarch-standard\tomcat.5.5.26\conf\Catalina\localhost do not use absolute paths to anything. Use magic variable ${catalina.home} to refer to extensions\engines-noarch-standard\tomcat.5.5.26\ like files from SAWS demo do.
- Make sure all jars you app depens on are present in the proper place. The java runtime and libs you used for development are not available to standalone Tomcat (and of course Tomcat running inside SAWS).
- If your code requires Java younger than 1.4.2 and you are creating Windows-only (or Win+Lin) product, you can install packages of Java for Tomcat that provide Java 1.5 and Java6 for Windows and Linux from here.