原文地址:http://blog.csdn.net/Lizongbo/archive/2005/02/03/279034.aspx (我使用的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;)
1.下载:http://www./download/resin-3.0.10.zip 解压到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> 重新启动resin,访问 http://localhost/lizongbo/ 就可以看到效果。
6.配置虚拟主机:
在文件结尾处</server>之前加上下面一段:
<host id="lizongbo." 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. 127.0.0.1
保存host文件。
重新启动resin,重新打开浏览器。输入http://lizongbo./lizongbo/
就可以看到虚拟主机配置成功。
7.发布我的webapp的时候遇到了下面的错误信息。
org.xml.sax.SAXNotRecognizedException: http:///sax/features/validation
查找资料http://www.google.com/search?hl=zh-CN&inlang=zh-CN&newwindow=1&q=resin+org.xml.sax.SAXNotRecognizedException&lr=,(参考:http://www./svn/repos/projects/axamol/sax-pipeline/README)
需要新建一个 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启动成功了。
访问 http://lizongbo./mywebapp/,页面正常出现。
b.另外一种更简单的解决方法,不需要修改jdk的配置
((此方法没有测试过,请参考http://www-900.ibm.com/developerWorks/cn/webservices/ws-axisfaq/index.shtml和http://www./quercus/faq/question.xtp?question_id=295)):
<host id="lizongbo." 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 |
|