jetty and tomcat


tomcat is a java web server.

Get to the manager via localhost:8000/manager/html
Users are defined in /etc/tomcat6/tomcat-users.xml

<role rolename=”manager”/>
<user username=”admin” password=”yourPassWord” roles=”manager”/>


<role rolename=”tomcat”/>
<role rolename=”role1″/>
<user username=”tomcat” password=”tomcat” roles=”tomcat”/>
<user username=”both” password=”tomcat” roles=”tomcat,role1″/>
<user username=”role1″ password=”tomcat” roles=”role1″/>


Change the port number (default 8080); sudo nano /etc/tomcat6/server.xml

compile project

• Make sure that you have jarred up all required dependencies, and placed them in the WEB-INF/lib directory. For your project, you will need to have both the OptoCommon? stuff and FsDisplay?jarred up. Also in that directory, you should already see two other jars: raphaelgwt-r##.jar (“##” replaced by some numbers) and gwt-servlet.jar
• Ensure that in your web.xml file (Sandbox/WEB-INF/web.xml) the ip address that you have listed is that of the device you will be trying to connect to
• Right click on the Sandbox project-root, and select Google > GWT Complile: Click on the “Compile” button

to make a war file

From a shell window, navigate to the “war” directory of the project you want to jar/war up
* A .war file (web-archive) is fundamentally equivalent to a jar file (java archive): it’s created the same way.
From the project root, you should be in the “ProjectRoot?/war/” directory. At a bare minimum, you should see a WEB-INF directory and your root html file sitting there.
To jar/war up your content, type the following:
jar -cvf whateveryouwanttocallyourfile.war .
Mind the spaces, and the period at the end: “jar<space>-cvf<space>whateveryouwanttocallyourfile.war<space>.”
Whatever you name your war file will be the name that you use to access the content: e.g.
If you omit the “v”, it will not show you all the things it’s doing as it does them… no big deal.
After a few seconds, you should have a file called “whateveryouwanttocallyourfile.war” sitting in the directory.
Now you can either copy or move the file to wherever it is going to be needed: I like to move the file as opposed to copying it.
Move = “mv *.war /path/to/your/tomcatorwhatever/servlet/directory/webapps/.”

sudo mv ROOT.war /var/lib/tomcat6/webapps/ is where you put your main war file.
For some reason I have two different installs react differetly to calling the file ROOT. One extracted it correctly and you could get to the index.html ok. The other simply would not auto detect or extract the ROOT.war. Soon as I called the same file a different name, it auto created a sub dir of the project name and extracted it. Trouble then was to get to the site, you needed to go to

Stress test

ab -k -n 5000 -c 149 will run apache benchmark with 5000 connections, 149 of which will be concurrent against the host name.


Jetty is a light weight java web server.
apt-get install jetty to install it.
sudo nano /etc/default/jetty to edit the server. You need to make it auto start if nothing else.
While you are in there, add this;

Note, its crittical to add the to listen to other hosts. (Took me a LONG time to find this gem on the web!!!)
The comments are very confusing about this line. I just know that we got it accepting outside connections when this line was uncommented!

Note there are three config files that might need tweaking if you want to change the SSL port that Jetty works with;
The first is as above, it sets the usual http port that Jetty will listen for connections on.
sudo nano /etc/jetty/jetty.xml is the main config file. In there you will find a line setting the “confidentialPort”. This is the SSL port that Jetty will listen on.
sudo nano /etc/jetty/jetty-ssl.xml has the SSL port listed. You will need to change it in there as well.
If you want to add SSL support to Jetty, you need to do the following;

Stop jetty: sudo /etc/init.d/jetty stop
Add a line to the file: sudo nano /etc/jetty/jetty.conf
The new line is: /etc/jetty/jetty-ssl.xml
Start jetty: sudo /etc/init.d/jetty start

You install your WAR file in /var/lib/jetty/webapps
Note you may have to clean out the trash every now and then; /var/cache/jetty

sudo service jetty check to see what jetty is up to.
netstat -tln to see what ports are being opened and listened to on the server (hint, if you don’t see jettys port listed there, things are not going as expected).

Leave a comment