Friday, March 5, 2010

Multiple instances of Jetty

I recently had to run multiple instances of Jetty on the same machine. I thought seeing to it that the two instances run on different ports should allow them to run independently but this did not work. I got the following error:

                        Starting Jetty: Already Running!!

To allow multiple instances of Jetty to run use pay attention to the line

    Configure id="Server" class="org.mortbay.jetty.Server"

in the jetty.xml file (or configuration file). Here make sure that the id parameter is unique to your Jetty  instance. While this solves the issue, poking around somemore with the innards of jetty.sh reveals some absolute paths that, in my book, are better when turned to relative paths, especially in this case where we are trying to run multiple instances.

The JETTY_RUN is the parameter which decides where the jetty.pid file should be stored. It defaults to the first available of /var/run, /usr/var/run, and /tmp if not set. Change this value to an absolute path that is unique to this instance of Jetty should address the issue.



I found some of this information at http://capitalcodemonkey.blogspot.com/2008/04/creating-multiple-jetty-server.html

No comments:

Post a Comment