-
Notifications
You must be signed in to change notification settings - Fork 81
Installation Jetty
These instructions describe how to create a clean, snappy and complete Railo installation on Jetty, without the need for an additional Web Server such as Apache. Url rewriting is handled by Tuckey urlrewrite filter.
Get the hightide download for version 7.0.1 (latest stable release) http://www.webtide.com/resources/downloads.jsp You will have to register to get the download, but it is free. (The regular Jetty release at eclipse is missing some of the jars needed to make railo work.)
Expand the Jetty archive to any directory.
Run java -jar start.jar OPTIONS=All. Jetty will issue a number of messages like "...Logging..., ...deploy..., ...extract...", but you shouldn't see any error messages. Verify the installation by browsing to localhost:8080. You should see a "Welcome to Jetty Hightide..." page. This says that java is installed correctly and Jetty is running. Terminate Jetty with ctrl-c.
The expanded download contains a number of things that are not needed for a dev or production server. Jetty uses maven but those parts are not necessary to run jetty. It also comes with a number of option jars that the average Railo server will not need.
The following defines what to remove and can be used as a batch file on Windows machines:
rmdir /S /Q Assembly |
rmdir /S /Q contexts-available |
rmdir /S /Q javadoc |
rmdir /S /Q resources |
rmdir /S /Q META-INF |
rmdir /S /Q webapps |
Jetty comes with a number of test items. Delete everything in the contexts folder including any sub-folders. Leave the contexts folder itself.
rmdir /S /Q contexts |
mkdir contexts |
Delete optional items
rmdir /S /Q lib\annotations |
rmdir /S /Q lib\policy |
rmdir /S /Q lib\jta |
rmdir /S /Q lib\setuid |
rmdir /S /Q lib\slf4j |
rmdir /S /Q lib\jdbc |
rmdir /S /Q lib\ext |
rmdir /S /Q lib\security |
rmdir /S /Q lib\jndi |
rmdir /S /Q lib\spring |
Remove jar files. It looks like you're removing everything, but unless you are developing in Java you will never use these deleted parts. If you want to use Apache as the front-end server, keep jetty-ajp-7.0.1.v20091125.jar. (Remember, these instructions result in a fully functioning install without Apache)
del /Q lib\jetty-rewrite-7.0.1.v20091125.jar |
del /Q lib\jetty-policy-7.0.1.v20091125.jar |
del /Q lib\jetty-plus-7.0.1.v20091125.jar |
del /Q lib\jetty-jndi-7.0.1.v20091125.jar |
del /Q lib\jetty-client-7.0.1.v20091125.jar |
del /Q lib\jetty-annotations-7.0.1.v20091125.jar |
del /Q lib\jetty-websocket-7.0.1.v20091125.jar |
Comment out or delete the following line if you will not use Apache
del /Q lib\jetty-ajp-7.0.1.v20091125.jar
Delete unneeded config files
del /Q etc\jetty-jsp.xml |
del /Q etc\jetty-spring.xml |
del /Q etc\login.properties |
del /Q etc\login.conf |
del /Q etc\jetty-setuid.xml |
del /Q etc\jetty-jaas.xml |
del /Q etc\jetty-rewrite.xml |
del /Q etc\jetty-logging.xml |
del /Q etc\jetty-policy.xml |
del /Q etc\jetty-plus.xml |
del /Q etc\jetty-xinetd.xml |
del /Q etc\jetty-stats.xml |
del /Q etc\jetty-ssl.xml |
del /Q etc\jetty-proxy.xml |
del /Q etc\jetty-fileserver.xml |
del /Q etc\jetty-debug.xml |
del /Q etc\jetty-bio-ssl.xml |
del /Q etc\jetty-bio.xml |
del /Q etc\jetty-ajp.xml |
del /Q etc\jdbcRealm.properties |
These config files must remain
/etc/jetty.xml |
/etc/jetty-jmx.xml |
/etc/webdefault.xml |
/etc/realm.properties |
/etc/keystore |
Download the latest Railo jars from http://www.getrailo.org/index.cfm/download/
under "Railo Custom The war files and the Railo JAR's can be used for a complete individual installation. All OS"
As of June 2010, the direct links are
Expand the Railo Jars into a railo folder inside of {Jetty-Install}/lib/. So you will end up with a /lib/railo folder that contains all of the jars from the railo download. This is a server wide install of Railo which means that any web context that runs on this server will have access to Railo.
Go to http://tuckey.org/urlrewrite/ and download the urlrewrite filter. As of June 2010 Beta 3.2 works for me.
Create a folder inside of the {Jetty-Install}/lib/ folder to contain extra jar files that you may use. Putting it in a separate folder will keep it separate from the standard Jetty install for easier upgrading in the future. For these instructions we'll call that folder myExtras. Copy the urlrewrite*.jar to the myExtras folder.
Now all of the files are in place and we just need to configure everything.
Change the line
OPTIONS=Server,plus,jta,jdbc,annotations,jsp,resources,websocket
to
OPTIONS=All
(The options parameter is case sensitive, that is OPTIONS=ALL doesn't work.)
comment out or delete
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.deploy.WebAppDeployer">
<Set name="contexts"><Ref id="Contexts"/></set>
<Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</set>
<Set name="parentLoaderPriority">false</set>
<Set name="extract">true</set>
<Set name="allowDuplicates">false</set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</set>
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</arg>
<Arg>.*/jsp-api-[^/]*\.jar$|.*/jsp-[^/]*\.jar$</arg>
</call>
</new>
</arg>
</call>
Change 8080 to 80 so that this line
<Set name="port"><SystemProperty name="jetty.port" default="8080"/></set>
Becomes
<Set name="port"><SystemProperty name="jetty.port" default="80"/></set>
Re-define servlet-mapping
Replace
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern>
</servlet-mapping>
with
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>*.cfm</url-pattern>
<url-pattern>*.cfml</url-pattern>
<url-pattern>*.cfc</url-pattern>
<url-pattern>*.cfm/*</url-pattern>
<url-pattern>*.cfml/*</url-pattern>
<url-pattern>*.cfc/*</url-pattern>
</servlet-mapping>
Add welcome-file-list. paste in these lines
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.cfm</welcome-file>
<welcome-file>index.cfml</welcome-file>
</welcome-file-list>
Add CFML Servlet. paste these lines
<servlet>
<servlet-name>CFMLServlet</servlet-name>
<description>CFML runtime Engine</description>
<servlet-class>railo.loader.servlet.CFMLServlet</servlet-class>
<init-param>
<param-name>railo-web-directory</param-name>
<param-value>{web-root-directory}/WEB-INF/railo/</param-value>
<description>Railo Web Directory directory</description>
</init-param>
<init-param>
<param-name>railo-server-root</param-name>
<param-value>lib/railo</param-value>
<description>Railo server configuration directory (where server admin root and configuration files will be stored)</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
If you need URL rewriting then paste in these lines in at the top of {jetty-install}/etc/webdefault.xml
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
For each context, create a file in the {jetty-install}/contexts folder, named MyWebbApp.xml (file can be named anything but I name mine after the domain), and paste into it:
"<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/</set>
<Set name="resourceBase">C:\MyWebRoot\MyWebApp</set>
<Set name="welcomeFiles">
<Array type="String">
<Item>index.cfm</item>
<Item>index.cfml</item>
<Item>index.htm</item>
<Item>index.html</item>
</array>
</set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</set>
<Set name="connectorNames">
<Array type="String">
<Item>0.0.0.0:80</item>
</array>
</set>
<Set name="virtualHosts">
<Array type="String">
<Item>MyWebbApp</item>
</array>
</set>
</configure>
where C:\MyWebRoot\MyWebApp is the file system location of the web app and MyWebbApp is the host name for the app.
For the url rewrite stuff to work, both Step 13 and this step are required. Create a directory "c:\MyWebRoot\MyWebApp\WEB-INF". Railo would create this directory when it runs, but we're not quite ready to run it yet. We'll need a file there named urlrewrite.xml. Paste this into it:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite
PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
"http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite>
<rule>
<from>^/some/olddir/(.*)$</from>
<to type="redirect">/very/newdir/$1</to>
</rule>
<rule match-type="wildcard">
<from>/blog/archive/**</from>
<to type="redirect">/roller/history/$1</to>
</rule>
</urlrewrite>
These rules are examples, you would put whatever redirect rules you actually want in their place.
TCP/IP uses the 'hosts' file to map a domain name to an ip address locally. See http://en.wikipedia.org/wiki/Hosts_file to learn more about it and where it goes on your particular operating system. You'll need a line in the hosts file that looks like:
192.168.127.100 MyWebApp
where 192.168.127.100 is a local IP address of your machine.
From the {jetty-install} directory, execute this:
java -Dcom.sun.management.jmxremote -DSTOP.PORT=8887 -DSTOP.KEY=railo -Xms256M -Xmx512M -Djava.awt.headless=true -jar start.jar etc/jetty-jmx.xml etc/jetty.xml
You should see some lines like this:
2010-05-31 19:26:57.078:INFO::Logging to StdErrLog::DEBUG=false via org.eclipse.jetty.util.log.StdErrLog
2010-05-31 19:26:57.859:INFO::jetty-7.0.1.v20091125
2010-05-31 19:26:57.953:INFO::Deploy D:\!JettyTest\contexts\projectBoaz.xml -> WebAppContext@1d225a7@1d225a7/,file:/D:/!devWebRoot/Boaz/
railo-server-root:C:\!Jetty\lib\Railo\railo-server
C:\!Jetty\lib\Railo\railo-server\patches\3.1.2.013.rc
Mon May 31 19:26:59 EEST 2010-843 Start CFML Controller
===================================================================
SERVER CONTEXT
-------------------------------------------------------------------
- config:C:\!Jetty\lib\Railo\railo-server\context
===================================================================
Mon May 31 19:27:01 EEST 2010-406 using JRE Date Library
Mon May 31 19:27:01 EEST 2010-625 write file:D:\jfreechart-patch.jar
Mon May 31 19:27:01 EEST 2010 Loaded Railo Version 3010213
===================================================================
WEB CONTEXT
-------------------------------------------------------------------
- config:C:\MyWebRoot\MyWebApp\WEB-INF\railo
- webroot:C:\MyWebRoot\MyWebApp
===================================================================
Where c:\!Jetty is the jetty install directory
You should also see several lines like this:
Mon May 31 19:27:02 EEST 2010-93 write file:C:\MyWebRoot\MyWebApp\WEB-INF\railo\context\*.*
Browse to http://MyWebApp and verify that the CFML files are rendered like you'd expect
++ If you're using port 80 already, you may want to use another port number such as 8080 instead of 80 in step 11 in this line:
<Set name="port"><SystemProperty name="jetty.port" default="80"/></set>
and in step 14 in this line:
<Item>0.0.0.0:80</item>
In this case, you would access the MyWebbApp site with http://MyWebApp:8080
- Getting to know Railo Server
- Railo Server features & specifications
- Getting started with Railo Server
- Installation & configuration
- Railo Server Versions
- Developing with Railo Server
- Deploying Railo Server apps
- Managing Railo Server apps
- Railo Server Extensions
- Useful resources & further reading
- Developing & debugging Railo Server
- FAQs