Server Deployment - Jetty
I try to run jetty as the same deployment structure as apache tomcat.
3 multi instances run in one ubuntu Server with one copy of my dist war package.
I installed 3 versions of jetty servers, jetty-6.1.3, jetty-7.4.1, jetty-8.0.0.
1. The shell script
The shell script start-jetty1.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-6.1.3"
JETTY_BASE="/home/luohua/tools/shellscript/jetty1"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar "${JETTY_BASE}/jetty.xml"
The shell script start-jetty2.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-7.4.1"
JETTY_BASE="/home/luohua/tools/shellscript/jetty2"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar --ini "${JETTY_BASE}/jetty.xml" jetty.port=8084
The shell script start-jetty3.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-8.0.0"
JETTY_BASE="/home/luohua/tools/shellscript/jetty3"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar --ini "${JETTY_BASE}/jetty.xml" jetty.port=8085
2. The jetty.xml configuration files in jetty1/jetty2/jetty3 directories
jetty1/jetty.xml (for jetty 6.1.3)
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port"><SystemProperty name="jetty.port" default="8083"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">1</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">1000</Set>
<Set name="lowResourcesMaxIdleTime">500</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
jetty2/jetty.xml (for jetty 7.4.1)
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8084"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
jetty3/jetty.xml (for jetty 8.0.0)
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8085"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
The dist war package easymarket.war is unzip to a directory named easymarket.
3. Access the web page
http://localhost:8083/easymarket
http://localhost:8084/easymarket
http://localhost:8085/easymarket
references:
http://hi.baidu.com/luohuazju/blog/item/f74d2151c87a961e367abea4.html
http://docs.codehaus.org/display/JETTY/Running+Jetty-7.0.x
I try to run jetty as the same deployment structure as apache tomcat.
3 multi instances run in one ubuntu Server with one copy of my dist war package.
I installed 3 versions of jetty servers, jetty-6.1.3, jetty-7.4.1, jetty-8.0.0.
1. The shell script
The shell script start-jetty1.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-6.1.3"
JETTY_BASE="/home/luohua/tools/shellscript/jetty1"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar "${JETTY_BASE}/jetty.xml"
The shell script start-jetty2.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-7.4.1"
JETTY_BASE="/home/luohua/tools/shellscript/jetty2"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar --ini "${JETTY_BASE}/jetty.xml" jetty.port=8084
The shell script start-jetty3.sh
#!/bin/sh
JETTY_HOME="/home/luohua/tools/shellscript/jetty-8.0.0"
JETTY_BASE="/home/luohua/tools/shellscript/jetty3"
export JETTY_HOME JETTY_BASE
cd ${JETTY_HOME}
java -jar start.jar --ini "${JETTY_BASE}/jetty.xml" jetty.port=8085
2. The jetty.xml configuration files in jetty1/jetty2/jetty3 directories
jetty1/jetty.xml (for jetty 6.1.3)
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port"><SystemProperty name="jetty.port" default="8083"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">1</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">1000</Set>
<Set name="lowResourcesMaxIdleTime">500</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.mortbay.jetty.Handler">
<Item>
<New class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
<Item>
<New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/>
</Item>
</Array>
</Set>
</New>
</Set>
jetty2/jetty.xml (for jetty 7.4.1)
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8084"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
jetty3/jetty.xml (for jetty 8.0.0)
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8085"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/easymarket</Set>
<Set name="resourceBase">/home/luohua/tools/shellscript/apps/easymarket</Set>
<Call name="addServlet">
<Arg>org.eclipse.jetty.servlet.DefaultServlet</Arg>
<Arg>/</Arg>
</Call>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
The dist war package easymarket.war is unzip to a directory named easymarket.
3. Access the web page
http://localhost:8083/easymarket
http://localhost:8084/easymarket
http://localhost:8085/easymarket
references:
http://hi.baidu.com/luohuazju/blog/item/f74d2151c87a961e367abea4.html
http://docs.codehaus.org/display/JETTY/Running+Jetty-7.0.x