TomCat is an application server which supports the JSP and java servlet standards, read more about it at: http://jakarta.apache.org/tomcat/.
TomCat currently does not work on RedBrick. We're still trying to fix it.
To use tomcat on RedBrick you must mail the webmaster/admins and ask for an account
You may access your servlets via http://jakarta.redbrick.dcu.ie/~[username]/servlet/[ServletName]
Once you have access you can put JSP files anywhere at all in your public_html directory, just make sure to use the extension ".jsp", in lowercase. They will be accessible as part of your site.
All classes go in the ~/public_html/WEB-INF/classes/ directory, typically this is also where you put other types of files, such as ".properties" files. .jar files go in ~/public_html/WEB-INF/lib .
Note: if you add a jar file, before it can work your webapp context has to be reloaded. You'll have to get the webmaster to do this, try not to do it very often.
yes, if the webmaster has done there job correctly, when you get access you should have a sample servlet and a sample JSP.
You should have "HelloWorldExample.class , HelloWorldExample.java, LocalStrings.properties, LocalStrings_en.properties, LocalStrings_es.properties" files in your ~/public_html/WEB-INF/classes directory.
HelloWorldExample.class is the actual class that provides the servlet, HelloWorldExample.java is the java source file used to create this class. If you read the java source you'll notice it uses the LocalStrings stuff, this requires the Localstrings files in your classes directory. This servlet can be accessed via:
You will also find a date.jsp file placed in your ~/public_html/ directory, since it uses a class called dates.JspCalender we need to provide it. You'll notice there's a directory called "dates" in your ~/public_html/WEB-INF/classes/ directory which provides this class. This jsp may be accessed via:
All JSP's and servlets run as the "jakarta" user, this means that you are sharing this username with other Tomcat users. There is the potential for abuse, but not much. Access to TomCat is given on a basis of trust, breaches of trust will be viewed seriously.
Because servlets and jsp run as the jakarta use any files you need to write to must be writable my the jakarta user. You can use an acl to achieve this, something like:"setfacl -rm u:jakarta:6 "
All of your subdirectories in WEB-INF should be 755 (or "a+rx"), all of your classes,jars and jsp's should be 644 (or "a+r"). Accessing something in http://jakarta.redbrick.dcu.ie/~[username]/WEB-INF/ doesnt seem to work, what's wrong?
The webserver has been configured to deny all attempts at accessing the WEB-INF directory.
Because of the way it works on redbrick, if you want to detect the remote IP address of the client you must use the alternative, direct , url. All you need do is change url's such as http://jakarta.redbrick.dcu.ie/~[username]/index.jsp to http://jakarta.redbrick.dcu.ie:8080/~[username]/index.jsp
Only if you use the direct form of the URL, as above. Add ":8080".
Tomcat wont try to reload your servlets or jsp's unless it has changed since the last time it accessed it. So if you forgot to add a set of classes that it needs, and it fails, just adding the classes wont be enough to fix it. You need to tell tomcat to refresh. You can do this by running: "touch [classname].class", in the same directory as the classes. After you do this, wait at least 15 seconds, and Tomcat will refresh your classes.
First off you'll need jakarta. If your in the CA labs this can be found on P\Projects\Web Servers\jakarta-tomcat-3.2.3 (This is the current version in the CA labs as of 23/2/2003).
There are a few variables you'll need to set up in order for tomcat to work. First off you'll need to set the variable JAVA_HOME to where ever your java folder is. E.g. if you were setting this up in the CA labs under Windows you'd need to type
You'll also need to set TOMCAT_HOME to where ever your jakarta folder is. E.g. in my CA account I have it at
Lastly you'll need to set up your CLASSPATH file to point to
I find it easier to put the above into the tomcat.bat file in jakarta-tomcat-3.2.3\bin, that way I don't have to remember to type them out everytime. Alternativly, you can just download my tomcat.bat file here
Note: This file might not work with other versions of tomcat, mine is 3.2.3. With other versions you may be best adding it youself.
Now all you'll need to do is run TOMCAT_HOME\bin\startup.bat in Windows or TOMCAT_HOME\bin\startup.sh in UNIX and if you point a web browser at http://localhost:8080 You should see the default Tomcat webpage.
There is other things you can do to files to make them more user friendly, the ones worth noting most are the servlet reloading without having to restart the server, and not having to put the :8080 at the end of localhost in your URL. To do this you can download my: server.xml and web.xml
Note: these are for the version of jakarta i'm using (3.2.3) and may not work with others.
To understand the changes i've made you're best of having a look at: http://www.moreservlets.com/Using-Tomcat-4.html#Configure-Tomcat