(我使用的jdk爲:jdk1.5.0_01,環境變量JAVA_HOME=D:/jdk1.5.0_01,
path=D:/jdk1.5.0_01/bin;%SystemRoot%/system32;%SystemRoot%;%SystemRoot%/System32/Wbem;)
解壓到D:/resin-3.0.10
2.運行setup.exe。指定resin Home:D:/resin-3.0.10
3.運行httpd.exe.
4.修改端口爲80:打開D:/resin-3.0.10/conf/resin.conf,
找到"8080",修改爲80,保存,重新啓動resin。
<!-- The http port -->
<http server-id="" host="*" port="80"/>
5.發佈webapp:
在resin.conf的結尾處: <host id="" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id='/' document-directory="webapps/ROOT"/>
</host>
修改爲:
<host id="" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/lizongbo/oscachedemo/test"/>
</host>
6.配置虛擬主機:
在文件結尾處</server>之前加上下面一段:
<host id="lizongbo.myresintest.com" root-directory=".">
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/jb/oscachedemo/test"/>
</host>
保存文件。
在c:/windows/system32/drivers/etc/host文件里加上下面一行:
lizongbo.myresintest.com 127.0.0.1
保存host文件。
就可以看到虛擬主機配置成功。
7.發佈我的webapp的時候遇到了下面的錯誤信息。
需要新建一個 jaxp.properties, 內容如下:
javax.xml.parsers.SAXParserFactory: org.apache.xerces.jaxp.SAXParserFactoryImpl
保存文件到$JAVA_HOME/jre/lib/下面
接下來可能會出現下面的錯誤信息:
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAX
ParserFactoryImpl could not be instantiated: java.lang.NullPointerException
因此還需要把xercesImpl.jar複製到D:/jdk1.5.0_01/jre/lib/endorsed下面(沒有這個目錄就創建這個目錄)
重新啓動resin,我的webapp啓動成功了。
b.另外一種更簡單的解決方法,不需要修改jdk的配置
<host id="lizongbo.myresintest.com" root-directory=".">
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/jb/oscachedemo/test">
<system-property javax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"/>
<system-property javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
<system-property org.xml.sax.driver="org.apache.xerces.parsers.SAXParser"/>
</web-app>
</host>
8.resin支持二級域名。
同6,主機名和doc路徑,都使用正則表達式。
(例子:<host url-regexp='^([^/]*).test.com' app-dir='web/$1'/>)
<host id="^(*).lizongbo.com" root-directory=".">
<!--
- configures an explicit root web-app matching the
- webapp's ROOT
-->
<web-app id='/' document-directory="webapps/ROOT"/>
<web-app id='/lizongbo' document-directory="E:/jb/oscachedemo/test"/>
</host>
再配合上泛域名解析,就非常方便了。
(在host文件里加上
127.0.0.1 aaa.lizongbo.com
127.0.0.1 bbb.lizongbo.com
然後訪問這兩個主機名,可以看見虛擬主機解析成功。
)
9.在Jbuilder2005中支持resin.
保存到 JBuilderHome/lib/ext下。
(Jb2005不支持)
10.一個host配置參考:
<host id='www.lizongbo.com'>
<welcome-file-list>index.jsp, index.htm, index.html </welcome-file-list>
<error-log id='logs/lizongbo.com.log'/>
<doc-dir>E:/jb/lizongbo/webapp</doc-dir>
<web-app id='/'>
<classpath id='WEB-INF/classes'
source='WEB-INF/classes'
compile='false'/>
<servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
<servlet-mapping url-pattern='*.jsp' servlet-name='jsp'/>
<servlet-mapping url-pattern='*.html' servlet-name='jsp'/>
<session-config>
<session-max>4096</session-max>
<session-timeout>30</session-timeout>
<enable-cookies>true</enable-cookies>
<enable-url-rewriting>true</enable-url-rewriting>
</session-config>
</web-app>
</host>
11.與IIS整合。
安裝好(WinXP+SP2下的)IIS,運行D:/resin-3.0.10/setup.exe
點Apply即可。
我的電腦-->右鍵-->管理-->Internet信息服務-->網站-->默認網站,
右鍵--〉屬性-->ISAPI篩選器-->添加
篩選器名稱:Resin_3.0.10
可執行文件:C:/Inetpub/scripts/isapi_srun.dll
確定,然後重新啓動iis。再啓動resin.此時就可以訪問
如果沒有啓動resin。
將得到下面的錯誤信息:
Can't contact Servlet Runner at localhost:6802
Copyright 2003-2005 www.sohozu.com All Rights Reserved