2009年3月6日星期五

How to deploy gwt rpc separated into Apache 2.2 and Tomcat 6.0:
I followed the GWT Tutorial and successfully ran the StockWatcher in hosted mode using Eclipse on Windows Vista 64bit, then was completed confused and lost at Using Tomcat with Apache HTTPD and a proxy, after some searching, guessing and trying, I finally got the StockWatcher server side deployed to Tomcat and the client side deployed to Apache, here are my configurations:

1. Tomcat 6.0.18 64-bit is installed at C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18, port is 8080
2. Apache 2.2.1 win 32-bit is installed at C:\Program Files (x86)\Apache Software Foundation\Apache2.2, port is 80
3. PHP 5.2.8 win 32 is installed under Apache 2.2 at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\php
4. MySQL 5.1.31 Win 32 is installed at C:\Program Files\MySQL\MySQL Server 5.1
5. mod_jk 1.2.27-httpd-2.2.10.so is installed under Apache 2.2 at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules
6. Modified the httpd.conf of Apach 2.2.1 with the following new lines:

ProxyPass /StockWatcher/StockWatcher/ http://localhost:8080/StockWatcher/
ProxyPassReverse /StockWatcher/StockWatcher/ http://localhost:8080/StockWatcher/

7. Create web.xml under Tomcat (C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\webapps\StockWatcher\WEB-INF) with the following contents:


<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<servlet>
<servlet-name>StockPriceService</servlet-name>
<servlet- class="">com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl</servlet->



<servlet-mapping> </servlet-mapping>
<servlet-name>StockPriceService</servlet-name>
<url-pattern>/StockPriceService</url-pattern>
</web-app>



8. Use the following lines to create the StockPriceService in StockWatcher.java:
 ((ServiceDefTarget) stockPriceSvc).setServiceEntryPoint( GWT.getModuleBaseURL() +
"StockPriceService");
9. Put the following line in the StockWatcher.gwt.xml:

<servlet path="/StockPriceService" class="com.google.gwt.sample.stockwatcher.server.StockPriceServiceImpl"> </servlet>


10. The following changes in Apache http.conf is to integrate Apache 2.2 and Tomcat 6.0 for generaly deployment purpose:

LoadModule jk_module modules/mod_jk.so

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /*.jsp worker1
JkMount /StockWatcher/StockPriceService worker1



C:/Program%20Files%20(x86)/Apache%20Software%20Foundation/Apache2.2/conf/workers.properties has the following lines:

worker.list= worker1
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.type=ajp13


11. The orginal source codes can be found at http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=GettingStartedTutorial

没有评论:

发表评论