原文地址:
http://blog.csdn.net/Lizongbo/archive/2005/02/03/279034.aspx(我使用的jdk為:jdk1.5.0_01,環(huán)境變量JAVA_HOME=D:\jdk1.5.0_01,
path=D:\jdk1.5.0_01\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;)
2.運(yùn)行setup.exe。指定resin Home:D:\resin-3.0.10
3.運(yùn)行httpd.exe.
4.修改端口為80:打開D:\resin-3.0.10\conf\resin.conf,找到"8080",修改為80,保存,重新啟動(dòng)resin。
<!-- The http port -->
<http server-id="" host="*" port="80"/>
5.發(fā)布webapp:
在resin.conf的結(jié)尾處: <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.配置虛擬主機(jī):
在文件結(jié)尾處</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文件。
就可以看到虛擬主機(jī)配置成功。
7.發(fā)布我的webapp的時(shí)候遇到了下面的錯(cuò)誤信息。
需要新建一個(gè) jaxp.properties, 內(nèi)容如下:
javax.xml.parsers.SAXParserFactory: org.apache.xerces.jaxp.SAXParserFactoryImpl
保存文件到$JAVA_HOME/jre/lib/下面
接下來可能會(huì)出現(xiàn)下面的錯(cuò)誤信息:
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAX
ParserFactoryImpl could not be instantiated: java.lang.NullPointerException
因此還需要把xercesImpl.jar復(fù)制到D:\jdk1.5.0_01\jre\lib\endorsed下面(沒有這個(gè)目錄就創(chuàng)建這個(gè)目錄)
重新啟動(dòng)resin,我的webapp啟動(dòng)成功了。
b.另外一種更簡(jiǎn)單的解決方法,不需要修改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支持二級(jí)域名。
同6,主機(jī)名和doc路徑,都使用正則表達(dá)式。
(例子:<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
然后訪問這兩個(gè)主機(jī)名,可以看見虛擬主機(jī)解析成功。
)
9.在Jbuilder2005中支持resin.
保存到 JBuilderHome/lib/ext下。
(Jb2005不支持)
10.一個(gè)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,運(yùn)行D:\resin-3.0.10\setup.exe
點(diǎn)Apply即可。
我的電腦-->右鍵-->管理-->Internet信息服務(wù)-->網(wǎng)站-->默認(rèn)網(wǎng)站,
右鍵--〉屬性-->ISAPI篩選器-->添加
篩選器名稱:Resin_3.0.10
可執(zhí)行文件:C:\Inetpub\scripts\isapi_srun.dll
確定,然后重新啟動(dòng)iis。再啟動(dòng)resin.此時(shí)就可以訪問
如果沒有啟動(dòng)resin。
將得到下面的錯(cuò)誤信息:
Can‘t contact Servlet Runner at localhost:6802